How to install apachesolr and configure Chinese word segmentation in ubuntu

Source: Internet
Author: User
Tags mkdir solr drupal

Each Document in Solr must have an attribute that uniquely identifies itself. By default, the attribute name is id, which is described in the Schema configuration file using: <uniqueKey> id </uniqueKey>.

Install jdk and Tomcat 7

Apt-get install openjdk-7-jdk
Apt-get install tomcat7 tomcat7-admin


Download and configure apachesolr

Http://archive.apache.org/dist/lucene/solr/

Download an object in the following format:

Solr-4.x.x.tgz

Download solr and try to use the latest 4.x version. The structure of the 5.x directory has been greatly changed.

Tar xzf solr-4.x.x.tgz
Cd solr.4.x. x. tgz

Cp example/lib/ext/*/usr/share/tomcat7/lib/
Cp dist/solrj-lib/*/usr/share/tomcat7/lib/
Cp dist/solr-4.x.x.war/var/lib/tomcat7/webapps/solr. war
Mkdir-p/var/lib/tomcat7/solr
Cp-r example/solr/collection1/conf/var/lib/tomcat7/solr/


Solr configuration

Https://www.drupal.org/project/search_api_solr

Rsync-av search_api_solr/solr-conf/solr-4.x // var/lib/tomcat7/solr/conf/

Use the scheme.xmlconfiguration of http://pan.baidu.com/s/1gduye8fto overwrite the following file

/Var/lib/tomcat7/solr/drupal/conf/scheme. xml

Vi/var/lib/tomcat7/solr. xml

<? Xml version = "1.0" encoding = "UTF-8"?>
<Solr persistent = "false">
<Cores adminPath = "/admin/cores">
<Core name = "drupal" instanceDir = "drupal"/>
</Cores>
</Solr>


Mkdir/var/lib/tomcat7/solr/drupal
Cp-r/var/lib/tomcat7/solr/conf/var/lib/tomcat7/solr/drupal/

If two environments are required, run the following command:

Cp/var/lib/tomcat7/solr/drupal/var/lib/tomcat7/solr/dev-r
Vi/var/lib/tomcat7/solr. xml


<? Xml version = "1.0" encoding = "UTF-8"?>
<Solr persistent = "false">
<Cores adminPath = "/admin/cores">
<Core name = "dev" instanceDir = "dev"/>
<Core name = "drupal" instanceDir = "drupal"/>
</Cores>
</Solr>

Configure IK Chinese word segmentation

To begin.


Cp IKAnalyzer2012FF_u1.jar/var/lib/tomcat7/webapps/solr/WEB-INF/lib/
Cp stopword. dic IKAnalyzer. cfg. xml/var/lib/tomcat7/webapps/solr/WEB-INF/classes

Modify the file owner and restart the service.

Service tomcat7 stop
Chown tomcat7: tomcat7/var/lib/tomcat7-R
Service tomcat7 start

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.