You need to download the following release packages before building the server:
Apache-solr-3.6.0-src.tgz
Apache-solr-3.6.0.zip
Lucene-3.6.0.zip
Lucene-3.6.0-src.tgz
After downloading the above packages, We will directly use the war package specified in the SOLR release package to quickly build the SOLR search server. This method generally cannot meet the actual needs of development, it is often used to quickly understand SOLR.
1. Copy the multicore under apache-solr-3.6.0 \ apache-solr-3.6.0 \ example to Apache-Tomcat-7.0.2 \ conf;
The multicore directory contains the basic configurations of SOLR. SOLR supports configuring multiple instances, that is, you can start multiple instances to serve different search requests at the front end. Each instance corresponds to a core, in this way, the configuration of multiple cores is through multicore \ SOLR. XML is configured, and detailed configuration of each core is matched in each directory under multicore, including schema. XML (configure fields and analyzer related to Lucene), solrconfig. XML (this is the core configuration of the SOLR instance ).
In addition, if. if the <datadir> index directory configuration is not specified in XML, the Apache-Tomcat-7.0.2 \ conf \ multicore \ data \ index directory is generated by default, which stores the index file.
2. Copy the apache-solr-3.6.0 under the apache-solr-3.6.0 \ apache-solr-3.6.0.war \ DIST to the Apache-Tomcat-7.0.2 \ webapps directory
3. Configure the war program context: Under APACHE-Tomcat-7.0.2 \ conf \ Catalina \ localhost (manually created if the directory does not exist), create a file apache-solr-3.6.0.xml,
The configuration of the apache-solr-3.6.0.xml is as follows:
<Context docBase="${catalina.home}/webapps/apache-solr-3.6.0.war" debug="0" crossContext="true" > <Environment name="solr/home" type="java.lang.String" value="${catalina.home}/conf/multicore" override="true" /> </Context>
Docbase specifies the location of our war file. The above "SOLR/home" is very important. After the Web Container starts, it loads the basic SOLR configuration and initializes the corresponding component instance, it searches for related Configurations Based on the specified "SOLR/home" configuration path.
4. Set the SOLR Character Set
By default, SOLR uses the UTF-8 character set encoding. If your Tomcat isn't, garbled characters may occur during Chinese search. If your Tomcat default port 8080 request character set is UTF-8 and you want to use this default port to provide search services, you can modify APACHE-Tomcat-7.0.2 \ conf \ Server. the content of the XML file is as follows:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" />
In the above we added a uriencoding = "UTF-8" configuration
After the configuration is complete, you can start Tomcat, and then enter: http: // localhost: 8080/apache-solr-3.6.0/in the browser address bar, if you see the following screen, it indicates that the configuration is successful: