I am struggling to prepare predicates, as per my requirement
I need to add MUST and SHOULD depend on user operator like IS,IS_NOT,Empty…etc
On based of operator I want to and MUST and SHOULD in end,
So can you guys help me to achive it , I will try to add some part code here
in hibernate search 5 I were using as below
query = queryBuilder.keyword().onField(criterion.getField()).matching(criterionValue).createQuery();
}
if (query != null) {
if (criterion.getOperator().equals(SearchOperatorsEnum.IS.getName())) {
booleanQuery = queryBuilder.bool()
.must(query)
.createQuery();
} else if (criterion.getOperator().equals(SearchOperatorsEnum.IS_NOT.getName())) {
Query allDocsQuery = queryBuilder.all().createQuery();
booleanQuery = queryBuilder.bool()
.must(allDocsQuery)
.must(query).not()
.createQuery();
} else {
throw new IllegalArgumentException ("Operator " + criterion.getOperator() + " for field " + criterion.getField() + " not valid");
}
So how to replace it in HS 6 or 7