Can Hibernate Search support Chinese analyzer when it integrate with Elastic Search?

#1

Can Hibernate Search support Chinese analyzer when it integrates with Elasticsearch?

0 Likes

#2

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?

0 Likes

#3

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.
0 Likes

#4

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:

  1. Enable a plugin in your Elasticsearch cluster. See https://www.elastic.co/guide/en/elasticsearch/plugins/5.6/analysis-smartcn.html
  2. Use @Analyzer(definition = "smartcn") in your mapping (to refer the Elasticsearch analyzer directly by its name) instead of @Analyzer(impl = SmartChineseAnalyzer.class)
0 Likes

#5

Thank you very much!

0 Likes