| There are a few code smells:
- Backend sub-components are mostly accessed through getters
- Some components, such as the SearchQueryBuilder implementations, have a lot of constructor parameters, and sometimes the arguments are passed by components that only retrieve the value through a getter.
This seems to indicate that some concepts are spread throughout the codebase instead of being encapsulated. Some additional components could probably be introduced to simplify the code. For instance a backend-scoped component dedicated to search that could be passed to index managers and used in place of the backend in SearchTargets. That component would have references to the work factory and query orchestrator, and would in particular allow to build a SearchQuery. Also, we should probably move index intialization code (currently in org.hibernate.search.v6poc.backend.elasticsearch.index.impl.ElasticsearchIndexManagerBuilder#build) to a dedicated component, especially since there are plans to parallelize this initialization. The two proposals above should allow to get rid of the Backend getters, but maybe some other components are missing. This is true for both the Lucene backend and the Elasticsearch backend. |