PlaceFilter.java - search improved.
@@ -164,7 +164,7 @@ public class PlaceFilter implements Specification<Place> {
/**
* Returns a predicate where {@link Place} has some values defined in the
- * incoming {@link FilterDiscountDto} object.
+ * incoming {@link FilterPlaceDto} object.
*
* @param r must not be {@literal null}.
* @param cb must not be {@literal null}.
@@ -175,12 +175,11 @@ public class PlaceFilter implements Specification<Place> {
if (filterPlaceDto.getSearchReg() == null) {
return cb.conjunction();
}
- return cb.and(cb.or(
- cb.like(r.join(RepoConstants.AUTHOR).get(RepoConstants.EMAIL), reg),
- cb.like(r.join(RepoConstants.CATEGORY).get(RepoConstants.NAME), reg),
- cb.like(r.get(RepoConstants.NAME), reg),
- cb.like(r.join(RepoConstants.LOCATION).get(RepoConstants.ADDRESS), reg),
- cb.like(r.get(RepoConstants.MODIFIED_DATE).as(String.class), reg)),
- cb.equal(r.get(RepoConstants.STATUS), status));
+ return cb.or(
+ cb.like(r.join(RepoConstants.AUTHOR).get(RepoConstants.EMAIL), "%" + reg + "%"),
+ cb.like(r.join(RepoConstants.CATEGORY).get(RepoConstants.NAME), "%" + reg + "%"),
+ cb.like(r.get(RepoConstants.NAME), "%" + reg + "%"),
+ cb.like(r.join(RepoConstants.LOCATION).get(RepoConstants.ADDRESS), "%" + reg + "%"),
+ cb.like(r.get(RepoConstants.MODIFIED_DATE).as(String.class), "%" + reg + "%"));
}
}
