`
lu_tan
  • 浏览: 26310 次
  • 来自: 上海
社区版块
存档分类
最新评论

solr4.9+mmseg4j

    博客分类:
  • solr
阅读更多

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 楼 langxuanlovehai 2014-10-10  
很好,很强大,正是我需要的,谢谢

相关推荐

Global site tag (gtag.js) - Google Analytics