In Solr4.10 configuration Ikanalyzer synonyms, extended thesaurus, pause words detailed

Source: Internet
Author: User
Tags solr

In the configuration of Ikanalyzer synonyms, encountered some trouble, configure a half-day finally success, here to make a record, convenient later reference

In fact, the configuration is also simple, mainly jar package, Ikanalyzer seems to have no one updated ... I also download from others to be available, I will also upload the jar package to my resources,

The download path is: http://download.csdn.net/download/tjcyjd/8430613

Add the following in SOLR's configuration file Schema.xml:

<!--ikanalyzer-->
   <fieldtype name= "Text_ik" class= "SOLR. TextField "positionincrementgap=" >  
     <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>

The Org.wltea.analyzer.lucene.IKAnalyzerSolrFactory class is its own extension, synonyms.txt under the solr_home/core/conf file.


Configure the extension word with the extended pause word configuration into the following:


IKAnalyzer.cfg.xml content is as follows:

<?xml version= "1.0" encoding= "UTF-8"?> <!
DOCTYPE Properties SYSTEM "Http://java.sun.com/dtd/properties.dtd" >  
<properties>  
  
<comment> IK Analyzer Extended Configuration </comment>
  
<!--user can configure their own extension dictionary here
  
<entry key= "Ext_dict" >ext.dic;</entry >
 
  
<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>

To this configuration complete, such as now need to configure the "Beijing" and "Beijing" two synonyms, as long as in the Synonyms.txt file add: Beijing, Beijing restart SOLR service can, if not take effect, save the file as Utf-8+bom.


Jar Package Download Address: 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.