We're already working on making nested predicates optional in HSEARCH-3752 Pull Request Sent , so the part you added about getting the nested path won't be useful in the next version of Hibernate Search. In the light of this, what exactly do full-text filters bring compared to this solution, which is simpler and type-safe?
public static class TestFilterFactory {
public SearchPredicate filter(SearchPredicateFactory f, String match) {
return f.match().field( fieldPath )
.matching( match )
.toPredicate();
}
}
() -> scope.query()
.where( f -> f.bool()
.minimumShouldMatchNumber( 3 )
.should( TestFilterFactory.filter( "match_fieldName", "blablabla" ) )
.should( TestFilterFactory.filter( "nested.match_fieldName", "blablabla" ) );
} ).toQuery()
|