solr4.5 mmseg4j 分词器配置

本文介绍如何在Solr中配置mmseg4j中文分词器,包括下载、安装及配置步骤。通过详细指南,帮助读者实现Solr的中文搜索功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、下载mmseg4j的下载地址:https://code.google.com/p/mmseg4j/ 版本选择mmseg4j-1.9.1.zip
2、解压mmseg4j-1.9.1
3、将解压后的\mmseg4j-1.9.1\dist中的jar拷贝到tomcat下solr的lib中
4、将\mmseg4j-1.9.1\中的data拷贝到solr/example/solr/collection1/下并重命名为dic(mmseg4j-1.9.*默认jar包中默认就有词典了
5、在schema.xml中配置mmseg4j,增加到<types>标签下:
<!-- mmseg4j分词器 -->
 <fieldType name="text_mmseg4j" class="solr.TextField" >
 <analyzer type="index">
<!--此处为分词器词典所处位置-->
 <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="complex" dicPath="../dic" />
 </analyzer>
 <analyzer type="query">
 <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="complex" dicPath="../dic" />
 </analyzer>
 </fieldType>

6、 用编辑器打开collection1/conf/schema.xml配置文件,找到<fields>…</fields>,修改需要使用中文分词的字段,type=”text_mmseg4j",
<field name="username" type="text_mmseg4j" indexed="true" stored="true" />

7、以上分词配置完毕


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值