`
zjnbshifox
  • 浏览: 312558 次
  • 性别: Icon_minigender_1
  • 来自: 宁波
社区版块
存档分类
最新评论

Solr试用小记

    博客分类:
  • Java
阅读更多
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 即可以测试
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics