Basic knowledge of running Solr in Eclipse, eclipsesolr

Source: Internet
Author: User

Basic knowledge of running Solr in Eclipse, eclipsesolr
I am still a newbie in Solr. Writing these articles only record my experiences with Solr in recent years.
What is Solr?
Recently, when I was studying Solr, I have seen a sentence that Solr is an out-of-the-box search server that can be used by enterprises and based on Lucene. I thought for a long time and didn't understand what this sentence meant. What is a search server? It is discovered that the so-called search Server is a project that can run the search program on the server (Tomcat, Jetty.
What can Solr do?
Anyone who knows about Lucene knows that Lucene is doing two things: index management and search. Solr is no exception. What it does is to simplify it.
If you are not familiar with Lucene, we recommend that you take a look at the first blog: Plugin In Action, the Chinese version of Lucene.
Next, let's get started. Since Solr is a search server, we certainly need it to be able to manage it in our Eclipse. Let's write some of my experiences.
Run Solr in Eclipse
1. Download the complete solr package. I use Solr 3.6.1;
2. Create a Dynamic Web project in Eclipse. My name is solr. You can also do this. If it is different, just pay attention to it when you access it.
3. delete all content under WebContent in the new project, decompress the apache-solr-3.6.1.war under the dist directory in the downloaded Solr full package, copy all the content inside to WebContent, after the copy is complete, there will be a Red Cross, don't worry, just don't see it.
4. Specify solrHome. solrHome is the place where solr core configuration files and indexes are stored.
Open the WEB-INF/web. xml file and add the following nodes:
Copy codeThe Code is as follows:
<Env-entry>
<Env-entry-name> solr/home </env-entry-name>
<Env-entry-value> E:/solr </env-entry-value>
<Env-entry-type> java. lang. String </env-entry-type>
</Env-entry>

The env-entry-name must be solr/home, And the env-entry-value node must be the place where you want to place the solr configuration file.
5. Add the solr configuration file
There are two ways to create or copy the core configuration file in the downloaded package.
Method 1: copy the file and go to the example/mutiCore directory in the downloaded package. You can see core1 and core2. Copy this folder and the solr. xml file below to solrHome.
Method 2: (1) create a file, enter solrHome, and create a solr. xml file. The configuration is as follows:
Copy codeThe Code is as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Solr persistent = "false">
<Cores adminPath = "/admin/cores">
<Core name = "merchant" instanceDir = "merchant"/>
</Cores>
</Solr>

The adminPath file is shown in the Code. It is best not to change it. The name in the core is random. It is best to have some practical significance, instanceDir. The directory of the core is specified here, and merchant is configured here, it means the merchant directory under solrHome.
Here I will explain the multi-core configuration. Here I only store one core, because our product only needs to perform full-text search for a merchant. If you need to search for files such as coupon, You need to configure multiple cores. Examples of multi-core are provided in the example/muticore folder. For more information, see.
(2 ). create a new merchant directory (consistent with the instanceDir in the configuration), create a new conf directory under merchant, and create two xml files in conf, namely schema. xml, solrconfig. xml. The configurations of these two xml files will be detailed in the next blog. If you do not know how to configure them, copy the two files in example/muticore/core1/conf.
6. Start solr in Eclipse
Add a new server in the servers window and add the newly created Project to it;
Modify the port, double-click the newly created server, and change the HTTP/1.1 port to 8983 in the port, which can be customized here. It is best not to repeat with other projects. Save the settings;
Start the server.
7. Open solr management panel in the browser
Open the following url: http: // localhost: 8983/solr/. Then you can see the Admin merchant option. Click to enter the Management Panel of the configured merchant core.

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.