I think that it would be easy to open such functionality is building a filter factory as a fragment of a predicate.
public static class TestFilterFactory implements FilterFactory {
@Override
public SearchPredicate create(FilterFactoryContext ctx) {
SearchPredicate filter = ctx.predicate()
.match().field( "fieldName" )
.matching( ctx.param( "match" ) )
.toPredicate();
return filter;
}
}
Such a filter could be, like in the previous version, declared using annotations.
@FullTextFilter(name="test_filter", factory = @FilterFactoryRef(type = TestFilterFactory.class))
public class Assortment implements Serializable {
....
Later, you could use such a filter when creating a query.
scope.query()
.where( f -> {
return f.bool()
.filter( f.def( "match_fieldName" ).param( "match", true ) );
}).toQuery()
I think that this functionality would be very simple to implement in the current code. |