SOLR Cloud Series-ik Chinese word breaker

Source: Internet
Author: User
Tags solr

The recent period of time in the project query needs to support Chinese word segmentation and Pinyin word segmentation, in the Internet to find a lot of information, now do the process of sorting out, later use can directly see, the following directly on the work.


SOLR cloud6.1.0 set IK word breakers:

Preparation information: Ik-analyzer-solr5-5.x.jar (this jar is found on the Internet in SOLR 6.x version can also be used)

IKAnalyzer.cfg.xml (IK extended participle and extended stop word settings)

Mydict.dic (extended participle)

Stopword.dic (extended stop word)


IKAnalyzer.cfg.xml's Content

<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE Properties SYSTEM "Http://java.sun.com/dtd/properties.dtd" >
<properties>
<comment>ik Analyzer Extended Configuration </comment>
<!--users can configure their own extension dictionary here to remove the comment
<entry key= "Ext_dict" >mydict.dic;</entry>
-
<!--users can configure their own extension stop word dictionary here--
<entry key= "Ext_stopwords" >stopword.dic;</entry>
</properties>

Download Address: http://download.csdn.net/detail/yangcl123/9753367

Configuration of the word breaker: (all machines are operated)

1. Put the IK word breaker jar package under web-inf/lib/, my directory is: solr-6.1.0/server/solr-webapp/webapp/web-inf/lib/

2. Create the Classes folder under the Web-inf directory (if not) and put the ikanalyzer.cfg.xml,mydict.dic,stopword.dic three files under the Classes folder


Managed-schema file:

To find your own Managed-schema file, prefer to increase the type of IK participle

<fieldtype name= "Test_ik" class= "SOLR. TextField ">
<analyzer type= "index" ismaxwordlength= "false" class= "Org.wltea.analyzer.lucene.IKAnalyzer"/>
<analyzer type= "Query" ismaxwordlength= "true" class= "Org.wltea.analyzer.lucene.IKAnalyzer"/>
</fieldType>

Set the type of the field that requires the word breaker to Test_ik

<field name= "Openbankname" type= "Test_ik" indexed= "true" stored= "true" multivalued= "false"/>

Modify these after uploading the configuration file to zookeeper

Replace a single profile, where the bank_link is my own directory name
./server/scripts/cloud-scripts/zkcli.sh-zkhost Node2:2181,node1:2181,node3:2181-cmd putfile/solr/configs/ Bank_link/managed-schema server/solr/configsets/bank_link/conf/managed-schema

OK, to this step configuration is complete the following to verify the next

First restart all the SOLR cloud nodes, after the restart is complete, find the corresponding collection,reload under the configuration file, the index needs to be rebuilt, the following is the location of reload




After that, we verify that the next participle configuration was successful.


Ok we see the participle is OK, the next chapter introduces the setting of phonetic participle.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.