Configuring the SOLR Server
1. Login to SOLR's official website to download the latest version, currently 5.5.0. Http://lucene.apache.org/solr/downloads.html
2.linux download tgz type, Windows system download Solr-5.5.0.zip
3. Unpack the folder after unpacking, open cmd Command window in this directory BIN\SOLR start default is 8983 port, use jetty at this time, open the browser access HTTP://LOCALHOST:8983/SOLR can see the SOLR server has been started successfully
4. Configuring core index Core in the cmd window BIN/SOLR create-c good, "good" is the name of the core to be created, at which time the index core of the SOLR server is established
5. To add an index to the Core:good, Java uses SOLRJ to add an index to the core concrete implementation can refer to/trade/src/main/java/com/echin/query/solrweb.java to this point, SOLR Server Basic configuration is complete.
Configure the Chinese word breaker for SOLR
SOLR Server default is not open Chinese word segmentation, then need to configure the Chinese word breaker, the current relatively popular ikanalyzer word breaker, mmseg4j word breaker, and SOLR comes with the word breaker SOLR. Smartchinesesentencetokenizerfactory
The solr-5.4.1 and mmseg4j-2.3.0 versions of this project configuration, described below how to configure mmseg4j-2.3.0 to solr-5.4.1
1. First login to Mmseg4j's official website HTTPS://GITHUB.COM/CHENLB/MMSEG4J-SOLR Download the latest version 2.3.0
2. Once the download is complete, place the extracted Mmseg4j-core-1.10.0.jar and Mmseg4j-solr-2.3.0.jar on the \solr-5.4.1\server\solr-webapp\webapp\ of the SOLR server Under the Web-inf\lib folder
3. The following paragraph is copied into your config file Managed-schema
<fieldtype name= "Textcomplex" class= "SOLR. TextField "positionincrementgap=" >
<analyzer>
<tokenizer class= "Com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode= "complex" dicpath= "/dic"/>
</analyzer>
</fieldtype>
<fieldtype name= "Textmaxword" class= "SOLR. TextField "positionincrementgap=" >
<analyzer>
<tokenizer class= "Com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode= "Max-word"/>
</analyzer>
</fieldtype>
<fieldtype name= "Textsimple" class= "SOLR. TextField "positionincrementgap=" >
<analyzer>
<tokenizer class= "Com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode= "simple" dicpath= "G:\ymy\solr\solr-5.4.1 \server\solr\good\dic "/>
</analyzer>
</fieldtype>
4. Now that MMSEG4J is configured successfully, join you have a field that needs to use this word breaker, plus the following sentence
<field name= "title" Type= "Textcomplex" multivalued= "false" indexed= "true" stored= "true"/>
Add extension thesaurus for Chinese word breaker
Dicpath parameter-sets a custom extension thesaurus that supports relative paths (relative to solr_home). If the path is not very familiar with the recommended write absolute path
Mode parameter-word breaker.
At this point mmseg4j Chinese word breaker configuration is complete
SOLR server configuration is complete, mmseg4j is also configured to the server, the remaining key step is how to let SOLR according to our own needs of the keyword search, such as "Love him Beautiful", "Happy Treasure", "flower underwear" and so on
1, first find Mmseg4j-core-1.10.0.jar, the jar package under the Data folder under the three files, Chars.dic,units.dic,words.dic
2. Copy these three files to G:\ymy\solr\solr-5.4.1\server\solr\good\dic
3. Add the words you want as keywords, such as "Love him beauty" to Words.dic, a word line, add the next, hit enter
Configuration of solr-5.4.1 and mmseg4j-2.3.0 versions