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