* Adds hibernate-search to build-all.sh
This commit is contained in:
@@ -86,6 +86,7 @@ if [[ "$MODULE" == "module5" ]]
|
||||
then
|
||||
# ADD NEW MODULES HERE
|
||||
# (add new modules above the rest so you get quicker feedback if it fails)
|
||||
build_gradle_module "spring-boot/hibernate-search"
|
||||
build_maven_module "spring-boot/spring-boot-logging-2"
|
||||
build_maven_module "spring-boot/spring-boot-docker"
|
||||
build_gradle_module "spring-boot/devtools-demo"
|
||||
|
||||
@@ -21,10 +21,10 @@ public class User {
|
||||
@Field(name = "fullName")
|
||||
private String first;
|
||||
|
||||
@Field(index = Index.NO)
|
||||
@Field(index = Index.NO, store = Store.YES)
|
||||
private String middle;
|
||||
|
||||
@Field
|
||||
@Field(store = Store.YES)
|
||||
@Field(name = "fullName")
|
||||
private String last;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SearchService {
|
||||
QueryBuilder qb = fullTextEntityManager.getSearchFactory().buildQueryBuilder()
|
||||
.forEntity(User.class)
|
||||
.get();
|
||||
Query similarToUser = qb.keyword().fuzzy().withEditDistanceUpTo(3).onField("first")
|
||||
Query similarToUser = qb.keyword().fuzzy().withEditDistanceUpTo(2).onField("first")
|
||||
.matching(first).createQuery();
|
||||
Query finalQuery = qb.bool().must(similarToUser).createQuery();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user