Factorize code related to index schema representation of the Elasticsearch and Lucene backends


These could probably be merged and moved to the engine:

  • ElasticsearchSearchIndexSchemaElementContext/LuceneSearchIndexSchemaElementContext

  • ElasticsearchSearchCompositeIndexSchemaElementQueryElementFactory/LuceneSearchCompositeIndexSchemaElementQueryElementFactory

  • Their implementations (maybe?)

  • ElasticsearchScopeSearchIndexesContext/LuceneScopeSearchIndexesContext (at least use an abstract base)

  • org.hibernate.search.backend.lucene.search.predicate.impl.PredicateTypeKeys and their counterparts for sorts, projections, aggregations. We may need to leave the ones that are backend-specific in the backend code, though.

Once it's done:

  • Field-related methods in ElasticsearchSearchPredicateBuilderFactoryImpl/LuceneSearchPredicateBuilderFactoryImpl could probably be inlined into the various Search DSLs: instead of requesting a builder from the builder factory, we would look for the field and request a query element from that field.

  • We could investigate the use of generics to merge LuceneSearchValueFieldQueryElementFactory with LuceneSearchCompositeIndexSchemaElementQueryElementFactory. The names are too long and complicated, it's a code smell.




Yoann Rodière


Yoann Rodière