SOLR and MMSEG4J Deployment
One. SOLR Installation
1. Download SOLR
http://www.apache.org/dyn/closer.cgi/lucene/solr/
2. Apache-solr-1.4.1.zip decompression, copy Dist/apache-solr-1.4.1.war to Tomcat_home/webapps, renamed to Solr.war, start Tomcat;
3. In the console to see the boot completed close Tomcat, there is no tube error;
4. Enter the Tomcat root directory, create a folder Solr_home, APACHE-SOLR-1.4.1\EXAMPLE\SOLR conf, data, bin three folders under Solr_home;
5. Enter Webapps/solr/web-inf, open Web. XML, line 37th, comment Open, modify as follows:
XML code
- <env-entry>
- <env-entry-name>solr/home</env-entry-name>
- <env-entry-value... /solr_home</env-entry-value>
- <env-entry-type>java.lang.string</env-entry-type>
- </env-entry>
6. At this point, start Tomcat again and access the HTTP://LOCALHOST:8080/SOLR,SOLR installation is complete.
Two. MMSEG4J Installation
1. Download mmseg4j
Http://code.google.com/p/mmseg4j/downloads/list
2. Unzip the mmseg4j-1.8.4.zip, copy the Mmseg4j-all-1.8.4.jar to Tomcat_home/webapps/solr/web-inf/lib;
3. Enter tomcat_home/solr_home/conf, open schema.xml, add between <types></types>: (I added 399 rows or so)
XML code
- <FieldType name="Textcomplex" class= "SOLR. TextField " >
- <Analyzer>
- <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="Complex " Dicpath="data/"/>
- </Analyzer>
- </FieldType>
- <FieldType name="Textmaxword" class= "SOLR. TextField " >
- <Analyzer>
- <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode= "Max-word " dicpath="data/"/>
- </Analyzer>
- </FieldType>
- <FieldType name="textsimple" class= "SOLR. TextField " >
- <Analyzer>
- <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="Simple" Dicpath="data/"/>
- </Analyzer>
- </FieldType>
4. Unzip the Mmseg4j-all-1.8.4-with-dic.war in a temporary folder and copy the Chars.dic, Units.dic, words.dic three dictionary files in the Data folder to tomcat_home/ In Solr_home/data;
5. Start Tomcat, Access http://localhost:8080/solr/admin/analysis.jsp, select the type in the field drop-down option, followed by Enter Textcomplex, and then in field The value of a random copy of the Chinese text, click Analyz, you can see the mmseg4j word results.
The integration of SOLR and mmseg4j