Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HSEARCH-3844 (
https://hibernate.atlassian.net/browse/HSEARCH-3844?atlOrigin=eyJpIjoiNDI...
)
Re: Exception: null: java.lang.NullPointerException when use simpleQueryString() (
https://hibernate.atlassian.net/browse/HSEARCH-3844?atlOrigin=eyJpIjoiNDI...
)
You are mixing two approaches here, which may be the reason you're getting this
exception.
*Step objects, like the one you're storing in the "select" and
"sort" variables, are not meant to be passed around at all. For that, you should
call toPredicate() / toSort() etc. and then you will get a SearchPredicate / SearchSort
/etc. that you can safely pass around and even re-use.
Try this:
if (searchFullText != null ) { select = scope.predicate().simpleQueryString() .field(
"shoppingName" ) .matching(searchFullText)
.defaultOperator(BooleanOperator.AND).toPredicate(); }
else { select = scope.predicate().matchAll().toPredicate(); }
SearchQuery<Assortment> query = session.search(scope)
.where(select)
.sort(sort).toQuery();
or this:
SearchQuery<Assortment> query = session.search(scope)
.where(f -> {
if (searchFullText != null ) { return f.simpleQueryString() .field(
"shoppingName" ) .matching(searchFullText)
.defaultOperator(BooleanOperator.AND); }
else { return f.matchAll(); }
} )
.sort( f -> ... ).toQuery();
(
https://hibernate.atlassian.net/browse/HSEARCH-3844#add-comment?atlOrigin...
) Add Comment (
https://hibernate.atlassian.net/browse/HSEARCH-3844#add-comment?atlOrigin...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100121- sha1:0fbe7c1 )