Hello Waldemar Kłaczyński. Your design submitted on HSEARCH-3862 Closed seems sound, but there are a few details to discuss. If you intend to submit a pull request, please hold until we agree on those details. First, I'm a bit sceptical as to the usefulness of that feature now that we allow predicates to be defined as lambdas. With the *current API*, you could do this:
public static class TestFilter {
public static SearchPredicate filter(SearchPredicateFactory f, boolean match) {
f.filter( f -> f..match().field( "fieldName" )
.matching( match )
.toPredicate;
}
}
scope.query()
.where( f -> f.bool()
.filter( TestFilter.filter( f, true ) )
.must( ... )
)
.toQuery()
This achieves the same result as your original proposal, without requiring any additional API, and guarantees type safety for the match param. Could you point out what the disadvantages of this solution are? |