windows下solr整合IKAnalyzer中文分词
1,文件位置说明
solr服务器目录位于D:\solr_tomcat;
tomcat目录位于D:\tomcat-6.0.18;
solr项目位于D:\tomcat-6.0.18\webapps\solr;
2,IKAnalyzer中文分词包下载,地址为 http://code.google.com/p/ik-analyzer/downloads/list,下载IKAnalyzer3.2.5Stable_bin.zip这个版本。
3,解压IKAnalyzer3.2.5Stable_bin.zip,把ext_stopword.dic、IKAnalyzer.cfg.xml文件拷贝到D:\tomcat-6.0.18\webapps\solr\WEB-INF\classes下,把IKAnalyzer3.2.5Stable.jar拷贝到D:\tomcat-6.0.18\webapps\solr\WEB-INF\lib下。
4,打开D:\solr_tomcat\conf\schema.xml,添加以下代码:
<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>
5,重启tomcat,打开http://localhost/solr/admin/analysis.jsp,Field下拉框选择Type,右侧输入框输入text_ik,下面输入框输入中文句子,即可查看分词效果。
相关推荐
spylyt 2020-09-11
江夏lz 2014-05-31
lionelf 2020-04-20
TyCoding 2020-01-08
wsxsxz 2019-12-14
upxiaofeng 2020-06-11
TyCoding 2020-05-03
upxiaofeng 2020-04-30
TyCoding 2020-04-08
TyCoding 2020-03-26
wenchanter 2020-03-26
roygbip 2020-02-16
wsxsxz 2020-02-03
lionelf 2020-02-03
lionelf 2020-02-03
TyCoding 2020-02-01
heniancheng 2020-01-31
lionelf 2020-01-30