eagleshi 发表于 2016-12-17 07:25:09

solr4.9+mmseg4j

  1.solr4.9
  mmseg4j-solr-2.2.0
  tomcat6
  jdk1.7
  2.步骤:
  前提:已经下载好TOMCAT、SOLR及MMSEG4J
  2.1 TOMCAT_HOME下创建文件夹solr_home,将solr_home\example\solr的bin及collection1复制到     solr_home,将solr-4.9.0.war复制到TOMCAT_HOME\webapps,且把solr-4.9.0.war改成solr.war;
  2.2 启动TOMCAT,这时会失败,不处理;
  2.3 TOMCAT_HOME\webapps\solr\WEB-INFO,web.xml中的
  <!--
  <env-entry>
  <env-entry-name>solr/home</env-entry-name>
  <env-entry-value>/put/your/solr/home/here</env-entry-value>
  <env-entry-type>java.lang.String</env-entry-type>
  </env-entry>
  -->改成
  <env-entry>
  <env-entry-name>solr/home</env-entry-name>
  <env-entry-value>../solr_home</env-entry-value>
  <env-entry-type>java.lang.String</env-entry-type>
  </env-entry>
  2.4  将solr_home\example\lib\ext下面的jar及mmseg4j-solr-2.2.0-with-mmseg4j-core中的jar包复制到                  TOMCAT_HOME\webapps\solr\WEB-INFO\lib; 
  2.5  修改solr_home\conf\schema.xml,将
  <fieldtype name="textComplex" class="solr.TextField" positionIncrementGap="100">
  <analyzer>
  <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="complex"                                     dicPath="dic"/>
  </analyzer>
  </fieldtype>
  <fieldtype name="textMaxWord" class="solr.TextField" positionIncrementGap="100">
  <analyzer>
  <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="max-word" />
  </analyzer>
  </fieldtype>
  <fieldtype name="textSimple" class="solr.TextField" positionIncrementGap="100">
  <analyzer>
  <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="simple"                                       dicPath="n:/custom/path/to/my_dic" />
  </analyzer>
  </fieldtype>复制到此文件;
  3.启动TOMCAT即可。
  注:可到此地址(https://github.com/chenlb/mmseg4j-solr)下载mmseg4j-solr-2.2.0-with-mmseg4j-core,也可在附件中直接下载,此版本支持solr4.9
页: [1]
查看完整版本: solr4.9+mmseg4j