Solr试用小记

1、下载tomcat7、solr 3.5.0 以及IKAnalyzer2012_u4,tomcat解压缩

2、展开solr压缩包,把包里的example\solr目录复制到D:\apache-tomcat-7.0.27(tomcat解压缩目录),把example\webapps目录的solr.war复制到D:\apache-tomcat-7.0.27\webapps,把solr包中,dist目录复制到D:\apache-tomcat-7.0.27\solr\dist

3、添加配置文件
1)D:\apache-tomcat-7.0.27\conf\Catalina\localhost\solr.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="D:/apache-tomcat-7.0.27/webapps/solr" debug="0" crossContext="true" >
<Environment name="solr/home" type="java.lang.String" value="D:/apache-tomcat-7.0.27/solr" override="true" />
</Context>


2) 修改D:\apache-tomcat-7.0.27\conf\server.xml

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"/>

4、启动tomcat即可以测试,但是此时还不能进行中文分词,需要将IK的包复制到
D:\apache-tomcat-7.0.27\webapps\solr\WEB-INF\lib
修改D:\apache-tomcat-7.0.27\solr\conf\solrconfig.xml
内容:
1)<lib dir="D:/apache-tomcat-7.0.27/solr/dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="D:/apache-tomcat-7.0.27/solr/dist/" regex="apache-solr-clustering-\d.*\.jar" />
<lib dir="D:/apache-tomcat-7.0.27/solr/dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
<lib dir="D:/apache-tomcat-7.0.27/solr/dist/" regex="apache-solr-langid-\d.*\.jar" />
<lib dir="D:/apache-tomcat-7.0.27/solr/dist/" regex="apache-solr-velocity-\d.*\.jar" />
2)<queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" enable="${solr.velocity.enabled:false}"/> 原来是true,修改为false
3)D:\apache-tomcat-7.0.27\solr\conf\schema.xml中增加
<fieldType name="text" class="solr.TextField">
<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
</fieldType>
这样即可以中文分词
http://localhost:8080/solr/admin/analysis.jsp 即可以测试
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值