SOLR 3.5 + TOMCAT7 + mmseg4j Configure and run

Source: Internet
Author: User
Tags solr

Installed on machine: Tomcat 7 jdk1.7

Visit HTTP://WWW.APACHE.ORG/DYN/CLOSER.CGI/LUCENE/SOLR, select a path in this URL, download the version of SOLR 3.5

1, will be extracted in SOLR in the LUCENE\APACHE-SOLR-3.5.0\EXAMPLE\SOLR directory of files copied to the location to be as a server, I was placed under this path: D:\luceneData\solr\home

2, the corresponding SOLR Web program is also copied out, that is lucene\apache-solr-3.5.0\example\webapps under the Solr.war copy to D:\luceneData\solr\server
3. Modify the Solrconfig.xml in the Solr-->home/conf folder to set the path of the data
<dataDir>${solr.data.dir:D:\luceneData\solr\home\data}</dataDir>


4. Set the appropriate Tomcat context (Server.xml)
<context path= "/SOLR" docbase= "D:\LUCENEDATA\SOLR\SERVER\SOLR" reloadable= "false" > <Context>


5, set the corresponding environment variables for the context, stating the address of SOLR's home directory
<context path= "/SOLR" docbase= "D:\LUCENEDATA\SOLR\SERVER\SOLR" reloadable= "false" >              <environment name= "Solr/home" type= "java.lang.String" value= "D:\luceneData\solr\home" override= "true"/><context>


6, start: Error caused by:java.lang.ClassNotFoundException:solr. Velocityresponsewriter
<queryresponsewriter name= "Velocity" class= "SOLR. Velocityresponsewriter "enable=" ${solr.velocity.enabled:true} "/>

Comment This code (in Solrconfig.xml). Cancels velocityresponsewriter this output format.

Verify: Access http://localhost:8088/solr/, if Welcome to solr! appears, stating that we have configured SOLR successfully ~

7. Add Chinese participle (schema.xml)

7.1 Copy the Chinese word-breaker package to the D:\luceneData\solr\server\solr\WEB-INF\lib directory


7.2 Adding Chinese participle to FieldType

<fieldtype name= "Textcomplex" class= "SOLR. TextField ">      <analyzer>        <tokenizer class=" com.chenlb.mmseg4j.solr.MMSegTokenizerFactory "mode = "complex" dicpath= "dic"/>      </analyzer>    </fieldType>     <fieldtype name= "Textmaxword" Class= "SOLR. TextField ">      <analyzer>        <tokenizer class=" com.chenlb.mmseg4j.solr.MMSegTokenizerFactory "mode = "Max-word" dicpath= "dic"/>      </analyzer>    </fieldType>     <fieldtype name= "Textsimple" Class= "SOLR. TextField ">      <analyzer>        <tokenizer class=" Com.chenlb.mmseg4j.solr.MMSegTokenizerFactory " Mode= "Simple" dicpath= "dic"/>      </analyzer></fieldType>



DICPATH Specifies the thesaurus location (each mmsegtokenizerfactory can specify a different directory, when it is relative to the directory, is a relative solr.home directory), mode specifies the word breaker (Simple|complex|max-word, Default is Max-word). We can also define the absolute path ourselves.


The fieldtype type, name is the FieldType, and class refers to the class name in the Org.apache.solr.analysis package that defines the definition of this type. The most important thing to define in FieldType is to define the parser analyzer that this type of data will use when indexing and querying, including word breakers and filtering.
Fields field: Define specific fields within a node (similar to fields in a database), which is field, containing name, type (for various FieldType defined previously), indexed (whether indexed), stored (whether stored Multivalued (if there are multiple values)
Copefield(Assignment field): Create a Copy field and copy all the entire text fields into a single field for a unified search.



SOLR 3.5 + TOMCAT7 + mmseg4j configuration and run

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.