Install Solr+tomcat

1. chose the release you want: http://archive.apache.org/dist/lucene/solr/.

1) copy [solr_home]/dist/apache-solr-3.6.0.war to tomcat/webapps, and modify the file name to "solr.war".

2) copy the fils under [solr_home]\example\solr to [tomcat_home]/.

3) create solr.xml (if not exists) if conf/Catalina/localhost under tomcat dir. The content following:

  <Context docBase="[tomat_home]/webapps/solr.war" debug="0" crossContext="true" >
    <Environment name="solr/home" type="java.lang.String" value="[tomcat_home]/solr" override="true" />
  </Context>

4)modify server.xml of tomcat, and find the item <Connector port="8080" (surpposing tomcat listens 8080 port). Then add the encoding. At last, it will be:

  <Connector port="8080" URIEncoding="UTF-8"

5) start tomcat, put in http://localhost:8080/solr/. Wolcoming page will show.

2. Deploy IKAnaliser:

1) Download "IK Analyzer 2012FF_hf1.zip": http://code.google.com/p/ik-analyzer/downloads/list.

2) Unzip "IK Analyzer 2012FF_hf1.zip". Then copy "IKAnalyzer2012FF_u1.jar" to [tomcat_home]/webapps/solr/WEB-INF/lib where solr.war is deployed.

3) Create file "classes" under [tomcat_home]/webapps/solr/WEB-INF, Copy IKAnalyzer.cfg.xml and stopword.dic into classes.

4) Deploy [tomcat_home]/solr/conf/schema.xml:

<!-- IKAnalyzer-->
  <fieldType name="text" class="solr.TextField">
  <analyzer class="org.wltea.analyzer.lucene.IKAnalyzer">
  </analyzer>
</fieldType>

3. Just start solr:

Blog [3] show the steps. But one thing which it doesn't discribe is that youo should copy solr.war into /example/webapp.

Reference:

[1] http://blog.csdn.net/witsmakemen/article/details/8256369

[2] http://sbp810050504.blog.51cto.com/2799422/1179312

[3] http://www.importnew.com/12607.html

上一篇:关于线上的bug什么时候修复的思考


下一篇:V​M​W​a​r​e​里​安​装​6​4​位​L​i​n​u​x​ ​的​方​法