Let say we have following entity {code:java} @Entity @Indexed public class YourAnnotatedEntity {
@Id @DocumentId private Long id;
@Field private String firstName;
@Field private String lastName; {code} Query constructed in following way
{code:java} Query query = qb.bool().must(qb.bool() .must(new TermQuery(new Term("id", "1"))).createQuery()) .filteredBy(qb.bool() .should(new TermQuery(new Term("firstName", "nonexisting"))) // should withing filter context, therefore at least one should match .must(new TermQuery(new Term("lastName", "jaric"))) .createQuery() ) .createQuery(); {code}
for given data set:
{code:java} YourAnnotatedEntity yourEntity = new YourAnnotatedEntity( 1L, "goran", "jaric" ); {code}
returns different results (0 documents) if hibernate.search.default.indexmanager=elasticsearch and different result (1 document) if hibernate.search.default.indexmanager=directory-based
If you use following patch, noneOfShouldMatchedWithinBooleanQueryInsideFilter_differentResults_directoryBasedVSElasticsearch test will fail, when you set it to directory-based, the same test will pass |
|