云计算高级群: 292870151 交流:Hadoop、NoSQL、分布式、lucene、solr、nutch
在Solr中配置中文分词IKAnalyzer
1、在配置文件schema.xml(位置{SOLR_HOME}/config/下),配置信息如下:
<!-- IKAnalyzer 中文分词-->
<fieldType name="text_ik" class="solr.TextField">
<analyzer type="index">
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="false"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
2、在IKAnalyzer相关的jar包(IKAnalyzer2012_u6.jar 本博客不提供下载)放在{SOLR_HOME}/lib下。
3、测试IKAnalyzer中文分词 效果: