中文分词mmseg4j+solr 5.3.1配置
程序员文章站
2022-05-17 12:36:03
...
基础环境:
solr 5.3.1
mmseg4j-solr-2.3.0.jar
mmseg4j-core-1.10.0.jar
CentOS release 6.2 (Final)
java version "1.7.0_71"
jar添加:
位置:solr-5.3.1/server/solr-webapp/webapp/WEB-INF/lib
配置:
在schema.xml中加上如下配置
<!-- mmseg4j-->
<fieldtype name="textComplex" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="complex"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
</analyzer>
</fieldtype>
<fieldtype name="textMaxWord" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="max-word" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
</analyzer>
</fieldtype>
<fieldtype name="textSimple" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="simple" dicPath="my-ext-dic" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
</analyzer>
</fieldtype>
<!-- mmseg4j-->
重新启动环境,就可以在solr 管理台看到对应的分词器了
solr 5.3.1
mmseg4j-solr-2.3.0.jar
mmseg4j-core-1.10.0.jar
CentOS release 6.2 (Final)
java version "1.7.0_71"
jar添加:
位置:solr-5.3.1/server/solr-webapp/webapp/WEB-INF/lib
配置:
在schema.xml中加上如下配置
<!-- mmseg4j-->
<fieldtype name="textComplex" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="complex"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
</analyzer>
</fieldtype>
<fieldtype name="textMaxWord" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="max-word" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
</analyzer>
</fieldtype>
<fieldtype name="textSimple" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="simple" dicPath="my-ext-dic" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
</analyzer>
</fieldtype>
<!-- mmseg4j-->
重新启动环境,就可以在solr 管理台看到对应的分词器了