下载 IKAnalyzer-2012FF_hf1_support_solr5.jar,并将它放到 solr 应用的 WEB-INF / lib 目录下
打开并编辑 $SOLR_HOME 下的 schema.xml 配置文件,加入如下配置
1 2 3 4 5 6 7 8
| <fieldType name="text_ik" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="org.wltea.analyzer.lucene.IKTokenizerFactory" useSmart="false" /> </analyzer> <analyzer type="query"> <tokenizer class="org.wltea.analyzer.lucene.IKTokenizerFactory" useSmart="true" /> </analyzer> </fieldType>
|
<analyzer type="index"> 配置索引分词
<analyzer type="query"> 配置搜索分词
useSmart="false" 使用细粒度分词,useSmart="true" 使用智能分词。

男士运动鞋中文分词结果
| 类别 |
分词 |
| 索引(细粒度分词) |
男士,运动鞋,运动,鞋 |
| 搜索(智能分词) |
男士,运动鞋 |