First, download all the software: Eclipse 4.3 environment +tomcat 7.5 +SOLR Software
Second, create a dynamic program File in the eclipse environment named SOLR2. Delete all the content under SOLR2 Webroot, and then unzip to find Solr.war folder, unzip it, put it into the webroot of SOLR2, this time will appear red fork, do not tube;
Third, copy to Webroot, then find the Web. XML, then configure the following:
<pre name= "code" class= "HTML" ><web-app xmlns= "Http://java.sun.com/xml/ns/javaee" xmlns:xsi= "/http/ Www.w3.org/2001/XMLSchema-instance " xsi:schemalocation=" Http://java.sun.com/xml/ns/javaee/http Java.sun.com/xml/ns/javaee/web-app_2_5.xsd " version=" 2.5 " metadata-complete=" true "><span style=" Color: #ff0000; " ><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> </span >
Where value is the location of the solrcore you store. Mine is tomcat1.7, so there will be an error in this place:
Cvc-complex-type.2.4.a:invalid content is found starting with element ' Env-entry-type '. One of ' {"Http://java.sun.com/xml/ns/javaee": Mapped-name, "http://java.sun.com/xml/ns/
Java ee ": injection-target} ' is expected.
I read a lot of Chinese blogs, but the answer is to test over the past, there is no solution, and some say that the direct conversion of 2.5 to 2.4 is not right, the method is simple to directly exchange value and type for a bit better. After the exchange, the following:
<span style= "color: #ff0000;" ><env-entry> <env-entry-name>solr/home</env-entry-name> </span><span style= "color:# 009900; " ><env-entry-type>java.lang.String</env-entry-type> <env-entry-value>e:/solr</ Env-entry-value></span><span style= "color: #ff0000;" ></env-entry> </span>
The above problem is solved.
Iv. Configure Solrcore, first set up the directory according to the value of step three configuration, and then create solr.xml under the Solr file. The Solr.xml is configured as follows:
which
Adminpath= "/admin/cores"
It's a fixed notation, we just need to configure Solrcore, and my solrcore name is hello.
Five., according to the Solrcore name written in step four, also create the Hello folder under the Solr folder, and then create the Conf folder under the Hello folder, go to Solrexample, Solrconfig.xml and Schema.xml files can be added to the Conf file. Of course we can configure multiple solrcore.
Six, then we can run, the results of the operation tomorrow, today to 1 points, the landlord slept, the roommate also turned off the lights, tomorrow to show the results.