I believe the best place to do the simplifying would be inside the boolean builders, e.g.:
- org.hibernate.search.backend.elasticsearch.search.predicate.impl.ElasticsearchBooleanPredicate.Builder#build
- org.hibernate.search.backend.lucene.search.predicate.impl.LuceneBooleanPredicate.Builder#build
We could e.g. introduce something like:
One thing that worries me, though, is if we introduce new options in the boolean predicate and forget to test for them in <no other option set> in the condition above. Then we’d end up ignoring these options in some cases. I wonder if there’s some way to prevent that from ever happening, just by implementing the build in some smart way… |