如何用Solr搜索汉字?
How to search chinese characters with Solr?
基本上我正在研究 Drupal 并使用 Solr 作为搜索引擎。它搜索一些简体中文 word/characters & 一些不喜欢下面的
美国:为美朝峰会同朝鲜进行的飏商取得进展
不是简单的字符搜索
所以我都经历了
https://lucene.apache.org/solr/guide/7_4/language-analysis.html
http://www.opencms-wiki.org/wiki/Solr_-_configuration_for_Chinese_and_correct_results_for_german_umlauts
& 在下面的 solr 配置文件中
<fieldType name="text_chinese" class="solr.TextField">
<analyzer class="org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer"/>
<analyzer>
<tokenizer class="solr.HMMChineseTokenizerFactory"/>
<filter class="solr.CJKWidthFilterFactory"/>
<filter class="solr.StopFilterFactory"
words="org/apache/lucene/analysis/cn/smart/stopwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
它正在给予
local:
org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
Could not load conf for core local: Plugin init failure for
[schema.xml] fieldType "text_chinese": Cannot load analyzer:
org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer. Schema file
is /var/solr/cores/local/conf/schema.xml
仍然没有给出结果。
不确定配置中是否缺少某些内容。
错误消息告诉您 Solr 无法找到您定义的分析器的实现 class - Cannot load analyzer: org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer
.
默认情况下不加载 SmartCN 分析器,但它包含在 contrib/analysis-extras/lucene-libs/lucene-analyzers-smartcn-<version number>.jar
下的二进制构建中。
Add the directory to the list of directories that Solr can load libraries from 在 solrconfig.xml:
<lib dir="../../../contrib/analysis-extras/lucene-libs" regex=".*smartcn.*\.jar" />
基本上我正在研究 Drupal 并使用 Solr 作为搜索引擎。它搜索一些简体中文 word/characters & 一些不喜欢下面的
美国:为美朝峰会同朝鲜进行的飏商取得进展
不是简单的字符搜索
所以我都经历了
https://lucene.apache.org/solr/guide/7_4/language-analysis.html http://www.opencms-wiki.org/wiki/Solr_-_configuration_for_Chinese_and_correct_results_for_german_umlauts
& 在下面的 solr 配置文件中
<fieldType name="text_chinese" class="solr.TextField">
<analyzer class="org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer"/>
<analyzer>
<tokenizer class="solr.HMMChineseTokenizerFactory"/>
<filter class="solr.CJKWidthFilterFactory"/>
<filter class="solr.StopFilterFactory"
words="org/apache/lucene/analysis/cn/smart/stopwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
它正在给予
local: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core local: Plugin init failure for [schema.xml] fieldType "text_chinese": Cannot load analyzer: org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer. Schema file is /var/solr/cores/local/conf/schema.xml
仍然没有给出结果。
不确定配置中是否缺少某些内容。
错误消息告诉您 Solr 无法找到您定义的分析器的实现 class - Cannot load analyzer: org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer
.
默认情况下不加载 SmartCN 分析器,但它包含在 contrib/analysis-extras/lucene-libs/lucene-analyzers-smartcn-<version number>.jar
下的二进制构建中。
Add the directory to the list of directories that Solr can load libraries from 在 solrconfig.xml:
<lib dir="../../../contrib/analysis-extras/lucene-libs" regex=".*smartcn.*\.jar" />