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