In Solr4.10, configure IKAnalyzer synonyms, extended word libraries, and pause words,

Source: Internet
Author: User

In Solr4.10, configure IKAnalyzer synonyms, extended word libraries, and pause words,

When I configured IKAnalyzer synonyms, I encountered some trouble and finally succeeded in configuration for half a day. I will make a record here for future reference.

In fact, the configuration is simple, mainly the jar package. IKAnalyzer does not seem to have been updated ...... I can only download the jar package from others. I also upload the jar package to my resources,

Download path: http://download.csdn.net/download/tjcyjd/8430613

Add:

<!--IKAnalyzer-->   <fieldType name="text_ik" class="solr.TextField" positionIncrementGap="100">       <analyzer type="index">         <tokenizer class="org.wltea.analyzer.lucene.IKAnalyzerSolrFactory"  isMaxWordLength="false"/>         <filter class="solr.LowerCaseFilterFactory"/>       </analyzer>       <analyzer type="query">         <tokenizer class="org.wltea.analyzer.lucene.IKAnalyzerSolrFactory"  isMaxWordLength="true"/>              <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>         <filter class="solr.LowerCaseFilterFactory"/>       </analyzer>     </fieldType>

Among them, the org.wltea.analyzer.w.e.ikanalyzersolrfactoryclass is extended, and synonyms.txt is in the solr_home/core/conf file.


Configure extension words and extension pause words:


The content of IKAnalyzer. cfg. xml is as follows:

<? Xml version = "1.0" encoding = "UTF-8"?> <! DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment> IK Analyzer Extension Configuration </comment> <! -- You can configure your own extended dictionary <entry key = "ext_dict"> ext. dic; </entry> --> <entry key = "ext_dict"> mydict. dic; </entry> <! -- You can configure your own extended stopword dictionary here --> <entry key = "ext_stopwords"> stopword. dic; </entry> </properties>

This configuration is complete. If you need to configure the "beijing" and "beijing" synonyms, you only need to add the "beijing" in the synonyms.txt file, and restart the solr service in beijing. If it does not take effect, save the file as a UTF-8 + BOM.


Jar: http://download.csdn.net/download/tjcyjd/8430613

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.