Solr配置中文分词器mmseg4j详解-linux版
2015-04-23 17:25
323 查看
针对Solr的分词器比较多,其中最常用的的两个是mmseg4j和ik-analyzer,至于他们的区别可以网上查找比较下,这两个分词器都挺好用。我搭建的Solr环境(上一篇 http://www.linuxidc.com/Linux/2015-01/112393.htm)是4.10.3的最新版本,以下将详细说下mmseg4j的配置。
1.首先下载对应的jar包。
版本号一定要对应上否则可能会报错,下载地址为:http://code.google.com/p/mmseg4j/ 但是这个网址好像需要翻墙,所以大家可以到我的上传资源下载:http://download.csdn.net/download/tjcyjd/8394095 。
2.将jar包拷贝到服务器solr的lib包下。()
三个包:mmseg4j-solr-2.2.0.jar,mmseg4j-analysis-1.9.1.jar,mmseg4j-solr-2.2.0.jar
3.配置schema.xml。
schema.xml的配置也挺简单,首先需要在schema.xml文件中配置一个fieldType节点,如下:
<!-- mmseg4j -->
<fieldType name="text_zh" class="solr.TextField"positionIncrementGap="100">
<spanstyle="white-space:pre"> </span><analyzer>
<span style="white-space:pre"> </span><tokenizerclass="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory"mode="complex" />
<spanstyle="white-space:pre"> </span></analyzer>
</fieldType>
然后就可以在field节点中引用该filedType了,假设你有个字段叫my_content需要支持中文分词,只需要定义示例filed节点如下:
<field name="my_content" type="text_zh"indexed="true" stored="false"multiValued="true"/>
4.重启Solr服务器。
5.测试。
浏览器输入地址:http://localhost:8080/solr/
解析“有什么好的电影推荐吗”的效果如下图:
http://www.linuxidc.com/Linux/2015-01/112394.htm
1.首先下载对应的jar包。
版本号一定要对应上否则可能会报错,下载地址为:http://code.google.com/p/mmseg4j/ 但是这个网址好像需要翻墙,所以大家可以到我的上传资源下载:http://download.csdn.net/download/tjcyjd/8394095 。
2.将jar包拷贝到服务器solr的lib包下。()
三个包:mmseg4j-solr-2.2.0.jar,mmseg4j-analysis-1.9.1.jar,mmseg4j-solr-2.2.0.jar
3.配置schema.xml。
schema.xml的配置也挺简单,首先需要在schema.xml文件中配置一个fieldType节点,如下:
<!-- mmseg4j -->
<fieldType name="text_zh" class="solr.TextField"positionIncrementGap="100">
<spanstyle="white-space:pre"> </span><analyzer>
<span style="white-space:pre"> </span><tokenizerclass="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory"mode="complex" />
<spanstyle="white-space:pre"> </span></analyzer>
</fieldType>
然后就可以在field节点中引用该filedType了,假设你有个字段叫my_content需要支持中文分词,只需要定义示例filed节点如下:
<field name="my_content" type="text_zh"indexed="true" stored="false"multiValued="true"/>
4.重启Solr服务器。
5.测试。
浏览器输入地址:http://localhost:8080/solr/
解析“有什么好的电影推荐吗”的效果如下图:
http://www.linuxidc.com/Linux/2015-01/112394.htm
相关文章推荐
- Solr配置中文分词器mmseg4j详解
- solr5.2.1分词器mmseg4j配置(Linux和Windows都可以)
- Solr配置中文分词器IK Analyzer详解
- solr4.5配置中文分词器mmseg4j
- solr配置中文分词器mmseg4j
- Solr配置中文分词器IK Analyzer详解
- solr4.5配置中文分词器mmseg4j
- solr4.5配置中文分词器mmseg4j
- solr4.5部署到tomcat以及solr4.5配置中文分词器mmseg4j
- Solr6.0.1配置中文分词器mmseg4j
- (四)Solr6.4.1配置中文分词器IK Analyzer详解
- solr6.1配置中文分词器IK-analyzer
- solr 6.4.1配置中文分词器
- solr 6.2.0系列教程(二)IK中文分词器配置及添加扩展词、停止词、同义词
- Solr配置中文分词器IKAnalyzer及增删改查调用
- 详解Linux环境下使Nginx服务器支持中文url的配置流程
- 你不知道的全文检索---solr安装中文分词器及配置业务字段
- solr 的安装与使用、中文分词器的配置
- solr3.5.1配置IKAnalyzer中文分词器