Can Hibernate Search support Chinese analyzer when it integrates with Elasticsearch?
If it’s just an analyzer like any other, there’s no reason it shouldn’t.
If there is something specific to this analyzer, maybe you can detail your concerns?
Project running failed.
The analyzer implementation 'org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer' is not supported with Elasticsearch. Please only use builtin Lucene analyzers that have a builtin equivalent in Elasticsearch.
I think this is just a problem with the automatic translation from Lucene analyzers to Elasticsearch analyzers.
SmartChineseAnalyzer is not included by default with Hibernate Search: you had to include an additional dependency. Therefore Hibernate Search doesn’t know about this class, and cannot possibly recognize it and translate it to the Elasticsearch equivalent.
If you want to use it, you will have to:
- Enable a plugin in your Elasticsearch cluster. See https://www.elastic.co/guide/en/elasticsearch/plugins/5.6/analysis-smartcn.html
@Analyzer(definition = "smartcn")in your mapping (to refer the Elasticsearch analyzer directly by its name) instead of
@Analyzer(impl = SmartChineseAnalyzer.class)
Thank you very much!