Common configurations of solr3.6.2 and solr4.9.0

Source: Internet
Author: User


Tomcat


Take Tomcat 7 as an example, location/work/Apache-Tomcat-7.0.55


SOLR 3.6.2


Basic Configuration


SOLR 3.6.2, which must be supported by JDK 6/JDK 7.


Download SOLR 3.6.2, unzip, Location:/work/apache-solr-3.6.2.


In the conf/Catalina/localhost directory of Tomcat, create a SOLR. xml file with the following content:

<Context docBase="/work/apache-solr-3.6.2/example/webapps/solr.war" privileged="true" allowLinking="true" crossContext="true">   <Environment name="solr/home" type="java.lang.String" value="/work/apache-solr-3.6.2/example/multicore" override="true" />  </Context>

Copy the content in the example/SOLR/conf directory to the example/multicore/core0/conf directory,

Start Tomcat and access: http: // localhost: 8080/SOLR/. If the SOLR interface is displayed, the basic configuration of SOLR core0 has been completed.


Tomcat Optimization Configuration:

<Connector port="9090" protocol="org.apache.coyote.http11.Http11NioProtocol"  executor="tomcatThreadPool"   connectionTimeout="20000"  maxThreads="5000" minSpareThreads="50"   acceptCount="5000" enableLookups="false"   compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plan"   compression="on" compressionMinSize="2048" disableUploadTimeout="true"   redirectPort="8443" URIEncoding="UTF-8"/>

Word Divider


Lucene3.2-3.6, ik analyzer 2012 U6 is required.

Download the IK tokenizer, create a lib directory under multicore, and place ik jar in the lib directory, for example, ikanalyzer2012_u6.jar, and modify SOLR under multicore. XML file. Add the attribute sharedlib = "lib" to the SOLR node.

If you need to configure the extended dictionary and the stopdictionary, you need to create the classes directory under the webapps/SOLR/web_inf directory of Tomcat and put ikanalyzer. cfg. XML and corresponding dictionary files are placed in this directory, ikanalyzer. cfg. the XML content is as follows:

<? XML version = "1.0" encoding = "UTF-8"?> <! Doctype properties system "http://java.sun.com/dtd/properties.dtd"> <Properties> <comment> ik analyzer configure </comment> <! -- You can configure your own extended dictionary here --> <Entry key = "ext_dict"> dic1.dic; dic2.dic; </entry> <! -- You can configure your own extended stopword dictionary here --> <Entry key = "ext_stopwords"> stopword. DIC; </entry> </Properties>

The dictionary file is configured as a UTF-8 encoding method without Bom.

Note: Put ikanalyzer. cfg. xml and related configuration files in the multicore/lib directory, which does not take effect.

Then, in schema. XML, the configuration type text_general uses ik Chinese word segmentation. The configuration node is as follows:

<fieldType name="text_general" class="solr.TextField">  <analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>  <analyzer type="index">  <tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" useSmart="false"/>  <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>  <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>  <filter class="solr.LowerCaseFilterFactory"/>  </analyzer>  <analyzer type="query">  <tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" useSmart="true"/>  <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>  <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>  <filter class="solr.LowerCaseFilterFactory"/>  </analyzer></fieldType>
All fields of the text_general type use ik word segmentation.

Stop dictionary


It refers to words that appear frequently but have little practical significance in the text. They mainly refer to adverbs, virtual words, and Modal words. Such as "yes" and ". It is mainly used in information retrieval. These words are removed when text or web pages are indexed.


Extended dictionary


A dictionary related to your business is processed as an independent word. Example: http://blog.csdn.net/shihuacai/article/details/8494360


Master/Slave


Solrconfig. XML, master machine Configuration:

<requestHandler name="/replication" class="solr.ReplicationHandler"><lst name="master"><str name="replicateAfter">startup</str><str name="replicateAfter">optimize</str><str name="confFiles">schema.xml</str><str name="commitReserveDuration">00:00:30</str><str name="numberToKeep">1</str></lst></requestHandler>


Solrconfig. XML, slave machine Configuration:

<requestHandler name="/replication" class="solr.ReplicationHandler"><lst name="slave"><str name="masterUrl">http://ip:8080/solr/core0/replication</str><str name="pollInterval">00:00:10</str><str name="compression">external</str><str name="httpConnTimeout">5000</str><str name="httpReadTimeout">10000</str></lst></requestHandler>


SOLR 1, 4.9


Basic Configuration


SOLR 4.9, which must be supported by JDK 7.


Download sorl 4.9, unzip, Location:/work/solr-4.9.0.

SOLR \ Dist \ solr-4.9.0.war to Tomcat \ webapps and renamed SOLR. War

Restart tomcat, SOLR. War automatic deployment, modify solrhome in webapps \ SOLR \ WEB-INF \ WEB. XML, as shown below:

    <env-entry>       <env-entry-name>solr/home</env-entry-name>       <env-entry-value>/work/solr-4.9.0/example/multicore</env-entry-value>       <env-entry-type>java.lang.String</env-entry-type>    </env-entry>

Copy solr-4.9.0 \ example \ Lib \ ext \ *. jar to Tomcat \ Lib

Copy the solr-4.9.0 \ example \ resources \ log4j. properties to Tomcat \ Lib

Restart Tomcat and access: http: // localhost: 8080/SOLR/. If the SOLR interface is displayed, the basic configuration of SOLR is complete.

The other parts are similar to those in section 3.6.2.


Word Divider


Download the IK analyzer. The ik Analyzer of javase4.x and solr4.x must use the following version of IK analyzer 2012ff_hfl.

Jar packages are placed under the tomcat/webapps/SOLR/WEB-INF/lib directory, XML and DIC are placed under the tomcat/webapps/SOLR/WEB-INF/classes directory.

Similar to 3.6.2


Master/Slave


Similar to 3.6.2.


Common configurations of solr3.6.2 and solr4.9.0

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.