The integration of SOLR and mmseg4j

Source: Internet
Author: User
Tags solr

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
  1. <env-entry>
  2. <env-entry-name>solr/home</env-entry-name>
  3. <env-entry-value... /solr_home</env-entry-value>
  4. <env-entry-type>java.lang.string</env-entry-type>
  5. </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
  1. <FieldType name="Textcomplex" class= "SOLR. TextField " >
  2. <Analyzer>
  3. <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="Complex " Dicpath="data/"/>
  4. </Analyzer>
  5. </FieldType>
  6. <FieldType name="Textmaxword" class= "SOLR. TextField " >
  7. <Analyzer>
  8. <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode= "Max-word " dicpath="data/"/>
  9. </Analyzer>
  10. </FieldType>
  11. <FieldType name="textsimple" class= "SOLR. TextField " >
  12. <Analyzer>
  13. <tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="Simple" Dicpath="data/"/>
  14. </Analyzer>
  15. </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

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.