Install and configure SOLR in Tomcat

Source: Internet
Author: User
Tags solr
SOLR Introduction

SOLR is a popular and extremely fast open-source enterprise search platform. Features include powerful full-text search, search keyword highlighting, Faceted search, near-real-time indexing, dynamic clustering, database integration, and rich File Processing (such as Word and PDF, and space search. SOLR is highly reliable, scalable, and fault tolerant. It provides distributed indexing, replication, and load balancing queries, automatic failover and recovery, centralized configuration, and more. The navigation and search functions of many of the world's largest Internet websites are implemented using SOLR.

SOLR is a full-text search Server Based on Lucene, written in Java, and run in servlet containers (such as jetty and tomcat). It provides a rest HTTP interface, it also supports multiple data formats such as JSON, PHP, Ruby, CSV, PHPs, javabin, and custom formats.

Used installation media
  1. Jdk1.7.0.45
  2. Tomcat 7.0.55
  3. Solr-4.9.0.tgz
  4. Ikanalyzer2012ff_u1.jar
Installation Steps

1: Install jdk1.7.0.45
2: install Tomcat 6.0.36
3: Install SOLR
# Decompress the file (assuming that the solr-4.9.0.tgz is in the/home/SOLR directory)
CD/home/SOLR

Tar-zxvf solr-4.9.0.tgz

Ln-s solr-4.9.0 SOLR

# Changing the SOLR working directory
CP-r/home/SOLR/example/SOLR/home/SOLR/solrhome


# Change SOLR web program directory
Mkdir solrweb
Cp solr/Dist/solr-4.9.0.war solrweb
CD solrweb
Jar-xvf solr-4.9.0.war
CD ../

# Copy the SOLR extension jar to Tomcat (assuming Tomcat is installed in the/home/SOLR/tomcat directory)
Cp solr/example/lib/EXT/*. Jar tomcat/lib


# Tell SOLR where its working directory is. Generally, there are two ways to set environment variables and JNDI. However, we recommend that you use JNDI for easy maintenance.
Create a SOLR. xml file in $ tomcat_home/CONF/Catalina/localhost with the following content:

<!--solr server configuration --><?xml version="1.0" encoding="UTF-8"?><Context docBase="/home/solr/solrweb" debug="0" crossContext="true" >     <Environment name="solr/home" type="java.lang.String" value="/home/solr/solrhome" override="true" />    </Context>
The/home/SOLR/solrhome is the so-called SOLR working directory. SOLR configuration and indexes will be stored in this directory.

Start Tomcat.
Http: // 17.063.233: 8080/SOLR

The default port is 8983. Modify the http port in Tomcat/CONF/server. xml.


4: Install the Chinese word segmentation ikanalyzer:
Put ikanalyzer2012ff_u1.jar in the/home/SOLR/solrweb/WEB-INF/lib directory
The corresponding configuration file is stored in the root directory of the jar package: ikanalyzer. cfg. XML, stopword. DIC, ext. DIC

5. Set the ikanalyzer Chinese Word Segmentation
Modify schema. XML in/home/SOLR/solrhome/collection1/CONF/and add the following content to <type> </types>:
<!-- china --><fieldType name="text_ik" class="solr.TextField"><analyzer type="index" isMaxWordLength="false" class="org.wltea.analyzer.lucene.IKAnalyzer"/><analyzer type="query" isMaxWordLength="true" class="org.wltea.analyzer.lucene.IKAnalyzer"/></fieldType>
The query adopts the largest word segmentation method of Ik, and the index adopts its fine-grained word segmentation method. Therefore, ismaxwordlength is configured separately.

6: start/stop SOLR

You only need to start/stop tomcat.

Verify


Reference

Http://lucene.apache.org/solr

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.