solr4.9与mmseg4j-1.9.1集成,其实很简单,主要有以下几步:
1、下载mmeseg4j-1.9.1,提取其中的三个文件:mmseg4j-analysis-1.9.1.jar, mmseg4j-core-1.9.1.jar,mmseg4j-solr-1.9.1.jar。放到目录:D:\apache\tomcat7-8983\webapps\solr\WEB-INF\lib下。jar包如图:
2、修改solr配置文件schema.xml,路径为D:\apache\tomcat7-8983\solrbase\solr\collection1\conf\schema.xml
首先配置 fieldType
<!-- mmseg4j-->
<fieldType name="text_mmseg4j_complex" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="complex" dicPath="dic"/>
</analyzer>
</fieldType>
<fieldType name="text_mmseg4j_maxword" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="max-word" dicPath="dic"/>
</analyzer>
</fieldType>
<fieldType name="text_mmseg4j_simple" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<!--
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="simple" dicPath="n:/OpenSource/apache-solr-1.3.0/example/solr/my_dic"/>
-->
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="simple" dicPath="dic"/>
</analyzer>
</fieldType>
<!-- mmseg4j-->
接下来配置field
<!-- mmseg4j -->
<field name="mmseg4j_complex_name" type="text_mmseg4j_complex" indexed="true" stored="true"/>
<field name="mmseg4j_maxword_name" type="text_mmseg4j_maxword" indexed="true" stored="true"/>
<field name="mmseg4j_simple_name" type="text_mmseg4j_simple" indexed="true" stored="true"/>
<!--mmseg4j -->
此时就配置完成了,就这么简单,启动solr测试下
mmseg4j-1.9.1 jar包下载:
http://download.csdn.net/detail/z1012890225/8982513