SOLR I am still a rookie, writing these articles is just a record of recent time to learn SOLR experience.
What is SOLR?
Recently, when I was learning solr, I had always seen a phrase that SOLR is an out-of-the-box search server for use in the enterprise, based on Lucene. At that time thought for a long time did not understand what the meaning of this sentence, what is the search server? When the contact is deep, it is found that the so-called search server, is able to run in the server (tomcat,jetty) a search program of a project.
What can SOLR do?
People who have known Lucene know that Lucene is doing two things, index management and search, and SOLR is no exception, and it is doing both things, just to make it more simplistic.
If you don't know Lucene well, it's recommended to take a look at the blog: http://www.cnblogs.com/forfuture1978/category/300665.html, this blog is very helpful to me when I just contacted Full-text search, Also recommend a book, English version of Lucene in Action, Chinese version of Lucene combat.
Now, to get to the point, since SOLR is a search server and we certainly need it to be managed in our eclipse, I'll write some of my experiences.
running SOLR in Eclipse
1. Download SOLR full package, I use SOLR 3.6.1;
2. Create a new dynamic WEB Project project in Eclipse, my name is SOLR, you can do so, if not the same, in your visit time to pay attention to it.
3. Delete all content under WebContent in the new project. The download of SOLR full package in the Dist directory of the Apache-solr-3.6.1.war decompression, all the contents of the inside copy to WebContent, after the copy is done there will be a red fork, forget it, when did not see.
4. Specifies that the solrhome,solrhome is where the SOLR core configuration files and indexes are stored.
Open the Web-inf/web.xml file and add the following nodes:
Copy Code code 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>
Where Env-entry-name must be the Solr/home,env-entry-value node is where you want to place the SOLR configuration file.
5. Add SOLR configuration file
Here are two ways to build your own or copy the core configuration file in the full package.
The first method: Copy, into the download package in the Example/muticore directory, you can see that there are core1,core2, this folder and the following Solr.xml file copy to Solrhome.
The second method: (1). New, enter Solrhome, new Solr.xml file, configure as follows:
Copy Code code as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
<SOLR persistent= "false" >
<cores adminpath= "/admin/cores" >
<core name= "merchant" instancedir= "merchant"/>
</cores>
</solr>
Where the AdminPath file as shown in the code, it is best not to change, the core name at random, the best is a certain practical significance, INSTANCEDIR, here specified the core directory, where the merchant configured, It means the merchant directory under the Solrhome.
Here's an explanation of the multi-core configuration, where I only have one core, because our product only needs to have a full-text search for a merchant. If necessary, such as the need for coupon and other documents to retrieve, you need to configure multi-core. Example/muticore folder gives a multi-core example, you can refer to.
(2). Create a new merchant directory (consistent with the Instancedir in the configuration), then create a new conf directory under Merchant, and create a new two XML file in Conf. Is Schema.xml,solrconfig.xml, the two XML configuration will be detailed in the next blog, if you do not know how to configure, copy example/muticore/core1/conf inside the two files to come in.
6. Start Solr in Eclipse
Create a new server in the Servers window and add the newly created item to it;
Modify the port, double-click the newly created server, the port inside the modified http/1.1 8983, here can be customized, it is best not to repeat with your other items. then save;
Start the server.
7. Open the SOLR admin panel in the browser
Open the following address, http://localhost:8983/solr/, and then you can see the admin merchant option, click Enter, just configure the merchant core Management panel.