zoukankan      html  css  js  c++  java
  • solrcloud配置中文分词器ik

    无论是solr还是luncene,都对中文分词不太好,所以我们一般索引中文的话需要使用ik中文分词器。

    三台机器(192.168.1.236,192.168.1.237,192.168.1.238)已经安装好了solrcloud

    我安装的是solr5.5使用的是ik是IKAnalyzer2012FF_u2.rar

    下载IKAnalyzer2012FF_u2.rar下载地址:http://download.csdn.net/detail/sunqingzhong44/9835849

    一下步骤三台机器都要操作

    下载后进行进行解压

    复制IKAnalyzer2012FF_u2.jar到tomcat/weapps/solr/WEB-INF/lib/下

    复制ext.dic,IKAnalyzer.cfg.xml到tomcat/weapps/solr/WEB-INF/classes下

    一下操作只在一台机器上操作即可

    下载collection在zookeeper上所对应的schema.xml配置文件

    [plain] view plain copy
     
    1. /usr/local/solr/server/scripts/cloud-scripts/zkcli.sh -zkhost 192.168.1.236:2181 -cmd getfile /configs/mycollection3  
    [plain] view plain copy
     
    1. /schema.xml schema.xml  

    /configs/mycollection3/schema.xml #这是zookeeper上的配置文件
    schema.xml #这是下载后的文件

    修改下载的schema.xml文件

    在最后增加:

    [html] view plain copy
     
    1. <fieldType name="text_ik" class="solr.TextField">  
    2.        <analyzer type="index" useSmart="false" isMaxWordLength="false" class="org.wltea.analyzer.lucene.IKAnalyzer"></analyzer>  
    3.        <analyzer type="query" useSmart="true"  isMaxWordLength="true" class="org.wltea.analyzer.lucene.IKAnalyzer"></analyzer>  
    4.    </fieldType>  

    可以在定义域的时候使用ik分词器:

    [html] view plain copy
     
    1. <field name="name" type="text_ik" indexed="true" stored="true"/>  
    2.   <field name="text" type="text_ik" indexed="true" stored="true"/>  


    上传修改好的配置文件schema.xml到zookeeper上

    [html] view plain copy
     
    1. /usr/local/solr/server/scripts/cloud-scripts/zkcli.sh -zkhost 192.168.1.236:2181 -cmd putfile /configs/mycollection2  
    [html] view plain copy
     
    1. /schema.xml  schema.xml  


    /configs/mycollection3/schema.xml #这是zookeeper上的配置文件
    schema.xml #这是修改后的文件

    重新启动tomcat后测试:

     

  • 相关阅读:
    [C++对象模型][4]指针与字符串
    [C++/CLI编程宝典][4]第一个C++/CLI程序
    [C++/CLI编程宝典][5]编译与反汇编
    Linux下软件安装卸载
    [C++/CLI编程宝典][7]基本概念
    Ubuntu linux安装ssh server
    [C++对象模型][2]指针与引用
    虚拟机vmwaretools+virtualboxguestadditions
    [C++/CLI编程宝典][6]IL中间语言
    AutoCAD ObjectARX和RealDWG资料
  • 原文地址:https://www.cnblogs.com/cxhfuujust/p/7735733.html
Copyright © 2011-2022 走看看