Ansj的使用和相关资料下载参考:http://iamyida.iteye.com/blog/2220833

  

  参考 http://www.cnblogs.com/luxh/p/5016894.html  配置和solr和tomcat的

1、从http://iamyida.iteye.com/blog/2220833下载好Ansj需要的相关的资料,下面是已下载好的。

Ansj资料: http://pan.baidu.com/s/1kTLGp7L

2、复制ansj相关文件到solr项目中

  1)将ansj_seg-2.0.8.jar、nlp-lang-0.2.jar和solr-analyzer-ansj-5.1.0.jar放到solr项目中

    放置目录:/luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF/lib

  2)将library.properties、libary目录和stopwords目录放置到solr项目中

放置目录:

[root@iZ23exixsjaZ classes]# pwd
/luxh/solr/apache-tomcat-8.0./webapps/solr/WEB-INF/classes
[root@iZ23exixsjaZ classes]# ls
library library.properties log4j.properties stopwords
[root@iZ23exixsjaZ classes]#

  3)配置library.properties

   按照自己的实际路径配置。

[root@iZ23exixsjaZ classes]# vi library.properties
#redress dic file path
ambiguityLibrary=/luxh/solr/apache-tomcat-8.0./webapps/solr/WEB-INF/classes/library/ambiguity.dic
#path of userLibrary this is default library
userLibrary=/luxh/solr/apache-tomcat-8.0./webapps/solr/WEB-INF/classes/library
#set real name
isRealName=true

3、在solr_home下建立一个collection

  1)创建一个collection叫collection1

[root@iZ23exixsjaZ solr_home]# pwd
/luxh/solr/solr_home
[root@iZ23exixsjaZ solr_home]# mkdir collection1

  2)拷贝/solr-5.3.1/server/solr/configsets/basic_configs下的内容到新建的collection1中

[root@iZ23exixsjaZ basic_configs]# pwd
/luxh/solr/solr-5.3./server/solr/configsets/basic_configs
[root@iZ23exixsjaZ basic_configs]# cp -r ./* /luxh/solr/solr_home/collection1/

4、配置collection1中的schema.xml,加入ansj分词配置

[root@iZ23exixsjaZ conf]# pwd
/luxh/solr/solr_home/collection1/conf
[root@iZ23exixsjaZ conf]# ls
currency.xml lang protwords.txt _rest_managed.json schema.xml solrconfig.xml stopwords.txt synonyms.txt
[root@iZ23exixsjaZ conf]# vi schema.xml

  加入如下内容:

<fieldType name="text_ansj" class="solr.TextField">
<analyzer type="index">
<tokenizer class="org.apache.lucene.analysis.ansj.AnsjTokenizerFactory"
query="false" pstemming="true" stopwordsDir="stopwords/stopwords.dic"/>
</analyzer>
<analyzer type="query">
<tokenizer class="org.apache.lucene.analysis.ansj.AnsjTokenizerFactory"
query="true" pstemming="false"/>
</analyzer>
</fieldType>

5、启动tomcat

[root@iZ23exixsjaZ apache-tomcat-8.0.]# bin/startup.sh 

6、通过 http://你的ip:8080/solr/admin.html        Add Core

  instanceDir指向刚才创建的collection1

7、测试

  1)英文

  2)中文

Solr整合Ansj中文分词器的更多相关文章

  1. Solr集成IK中文分词器

    1.将IKAnalyzer-2012-4x.jar拷贝到example\solr-webapp\webapp\WEB-INF\lib下: 2.在schema.xml文件中添加fieldType: &l ...

  2. 在eclipse中构建solr项目+添加core+整合mysql+添加中文分词器

    最近在研究solr,这里只记录一下eclipse中构建solr项目,添加core,整合mysql,添加中文分词器的过程. 版本信息:solr版本6.2.0+tomcat8+jdk1.8 推荐阅读:so ...

  3. Solr4.10与tomcat整合并安装中文分词器

    1.solr Solr 是Apache下的一个顶级开源项目,采用Java开发,它是基于Lucene的全文搜索服务器.Solr提供了比Lucene更为丰富的查询语言,同时实现了可配置.可扩展,并对索引. ...

  4. solr 7+tomcat 8 + mysql实现solr 7基本使用(安装、集成中文分词器、定时同步数据库数据以及项目集成)

    基本说明 Solr是一个开源项目,基于Lucene的搜索服务器,一般用于高级的搜索功能: solr还支持各种插件(如中文分词器等),便于做多样化功能的集成: 提供页面操作,查看日志和配置信息,功能全面 ...

  5. Solr6.5配置中文分词器

    Solr作为搜索应用服务器,我们在使用过程中,不可避免的要使用中文搜索.以下介绍solr自带的中文分词器和第三方分词器IKAnalyzer.  注:下面操作在Linux下执行,所添加的配置在windo ...

  6. 【solr】solr5.0整合中文分词器

    1.solr自带的分词器远远满足不了中文分词的需求,经查使用最多的分词器是solr是mmseg4j分词器,具体整合大家可以参考 https://github.com/zhuomingliang/mms ...

  7. 真分布式SolrCloud+Zookeeper+tomcat搭建、索引Mysql数据库、IK中文分词器配置以及web项目中solr的应用(1)

    版权声明:本文为博主原创文章,转载请注明本文地址.http://www.cnblogs.com/o0Iris0o/p/5813856.html 内容介绍: 真分布式SolrCloud+Zookeepe ...

  8. solr服务中集成IKAnalyzer中文分词器、集成dataimportHandler插件

    昨天已经在Tomcat容器中成功的部署了solr全文检索引擎系统的服务:今天来分享一下solr服务在海量数据的网站中是如何实现数据的检索. 在solr服务中集成IKAnalyzer中文分词器的步骤: ...

  9. 我与solr(六)--solr6.0配置中文分词器IK Analyzer

    转自:http://blog.csdn.net/linzhiqiang0316/article/details/51554217,表示感谢. 由于前面没有设置分词器,以至于查询的结果出入比较大,并且无 ...

随机推荐

  1. js实现图片实时预览

    注: 此博客转自 http://www.cnblogs.com/goody9807/p/6064582.html  转载请注明出处 <body> 上传图片: <input type= ...

  2. 将内存ffff:0~ffff:b中的数据拷贝到0:200~0:20b中

    我是按照字,也就是2个字节拷贝的. 这样就可以让循环减半== assume cs:sad sad segment start: mov ax, 0ffffh mov ds, ax mov bx, 0h ...

  3. VS 2005 修复重置(深度重置)

    /resetuserdata 参数 如果 Visual Studio 在运行时被损坏,且无法从损坏状态进行恢复,您可以使用此参数将 Visual Studio 重置到其使用之初的状态.这些问题的例子可 ...

  4. oracle更新语句merge和update

    update: update语句更新需要根据索引或者数据列遍历所有行 语句举例: update table1  a set column1=(select column from table2 b w ...

  5. mysql coalesce函数

    COALESCE函数从值列表中返回第一个非NULL的值,当遇到NULL值时将其替换为0. coalesce(str1,str2....); e.g.   需要在表中查出所有比'WARD'提成(COMM ...

  6. COCOS2D-X中UI动画导致闪退与UI动画浅析

    前两天和同事一起查一个游戏的闪退问题,log日志显示最后挂在CCNode* ActionNode::getActionNode()函数中的首行CCNode* cNode = dynamic_cast& ...

  7. IOS上解决内存越界访问问题

    IOS经常会混合使用C代码,而在C中,对内存的读写是很频繁的操作. 其中,内存越界读写 unsigned char* p =(unsigned char*)malloc(10); unsigned c ...

  8. 随机梯度下降(Stochastic gradient descent)和 批量梯度下降(Batch gradient descent )的公式对比、实现对比[转]

    梯度下降(GD)是最小化风险函数.损失函数的一种常用方法,随机梯度下降和批量梯度下降是两种迭代求解思路,下面从公式和实现的角度对两者进行分析,如有哪个方面写的不对,希望网友纠正. 下面的h(x)是要拟 ...

  9. 设置XtraForm标题居中

    public class CustomFormPainter : FormPainter { public CustomFormPainter(Control owner, DevExpress.Sk ...

  10. 集群工具ansible使用方法

    ansible简介 ansible是与puppet.saltstack类似的集群管理工具,其优点是仅需要ssh和Python即可使用,而不像puppet.saltstack那样都需要客户端.与pupp ...