SOLR Learning (1)

Source: Internet
Author: User
Tags solr

1. SOLR is an enterprise-level Search Server Based on the Lucene Java library. This article records the installation process of SOLR, version 1.4.1.

Http://lucene.apache.org/solr/ from SOLR's official website
Open the downloaded apache-solr-1.4.1.zip or apache-solr-1.4.1.tgz file to the apache-solr-1.4.1 directory.

2. Simple operation

1. CD apache-solr-1.4.1/Example
2. Java-jar start. Jar
3. Open the browser to access http: // localhost: 8983/SOLR/admin/

If you can see the SOLR search page, it indicates that SOLR is running properly.

3. Configure Tomcat

3.1 download Tomcat and configure

You may need to modify the port number.

3.2 find the example \ SOLR directory from the SOLR release package decompressed above. This directory can be used as a template for configuring SOLR.
Copy the example \ SOLR directory to another path, such as c: \ soft \ SOLR. This directory will be used as SOLR home.
Note that you need to modify a file, $ solr_home/CONF/solrconfig. XML, and find the datadir settings:
The default value is <datadir >$ {SOLR. Data. dir:./SOLR} </datadir>. The relative path is used, which must be changed to the complete path:
<Datadir >$ {SOLR. Data. dir: C: \ soft \ SOLR \ data} </datadir>
3.3 find the SOLR war package from the SOLR release package decompressed above
1) apache-solr-1.4.1/Dist/apache-solr-1.4.1.war

You can copy this war to the SOLR home directory.

3.4 add the Tomcat \ conf \ Catalina \ localhost \ SOLR. xml file

Content:

<? XML version = "1.0" encoding = "UTF-8"?>
<Context docbase = "C: \ soft \ SOLR \ apache-solr-1.4.1.war" DEBUG = "0" crosscontext = "true">
<Environment name = "SOLR/home" type = "Java. Lang. String" value = "C: \ soft \ SOLR" override = "true"/>
</Context>

3.5 start Tomcat

If you can see the SOLR search page, it indicates that SOLR is configured in Tomcat and runs properly.

4. install sample data

SOLR has some sample data and loading scripts in example/exampledocs.

CD to go to example/exampledoce and enter:

Java-jar post. jar *. XML (if it is in a Unix environment, run post. Sh)

Post. jar is a simple program that traverses all the parameters and then performs the default configuration (http: // localhost: 8983/SOLR/update) on the SOLR (example) server running on the local machine)

Send a POST request (HTTP ). Here we can look at post. Sh to understand what we are doing.

Is: Java-jar post. jar *. xml execution result, note that you need to open the server

5. Simple search

On the administrator interface, click search to obtain some XML documents:

This XML file does not appear to have any style information associated with it. The document tree is shown below.<response><lst name="responseHeader"><int name="status">0</int><int name="QTime">2</int><lst name="params"><str name="indent">on</str><str name="start">0</str><str name="q">solr</str><str name="version">2.2</str><str name="rows">10</str></lst></lst><result name="response" numFound="1" start="0"><doc><arr name="cat"><str>software</str><str>search</str></arr><arr name="features"><str>Advanced Full-Text Search Capabilities using Lucene</str><str>Optimized for High Volume Web Traffic</str><str>Standards Based Open Interfaces - XML and HTTP</str><str>Comprehensive HTML Administration Interfaces</str><str>Scalability - Efficient Replication to other Solr Search Servers</str><str>Flexible and Adaptable with XML configuration and Schema</str><str>Good unicode support: héllo (hello with an accent over the e)</str></arr><str name="id">SOLR1000</str><bool name="inStock">true</bool><date name="incubationdate_dt">2006-01-17T00:00:00Z</date><str name="manu">Apache Software Foundation</str><str name="name">Solr, the Enterprise Search Server</str><int name="popularity">10</int><float name="price">0.0</float></doc></result></response>

6. Summary

The first time I saw SOLR, I felt quite helpful. At least there were more configurations than the nutch number.

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.