My hope is that I can define both backends (lucene and elasticsearch) in one single class or by annotations.
As stated before, it definitely won't be possible in the future, so at best you're buying yourself some time. Also, be aware that in order to use phonetic analyzers in Elasticsearch, you need to install additional plugins on the server side: https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-phonetic-tokenfilter.html So you will need to take specific steps in Elasticsearch anyway; maybe in this case it make sense to take specific steps on the Hibernate Search side as well?
What is still missing in my head is a way how to replace DefaultElasticsearchAnalyzerDefinitionTranslator by a CustomTranslator. I tried to register it by referencing this class in META-INF/services/org.hibernate.search.elasticsearch.settings.impl.translation.ElasticsearchAnalyzerDefinitionTranslator. But then I get an exception with message [...]
Ok, so you didn't make it work yet. Maybe let's continue the discussion on your PR? I provided a suggestion to implement things differently, which wouldn't require applications to implement a custom translator. |