One: Install the SOLR server
1. Import the installation package into the/USR/LOCAL/SOLR/SINGLESOLR directory
Unzip move to TOMCAT-SOLR directory
2. Copy War to Tomcat/webapps
CP Solr-4.10.3/example/webapps/solr.war Tomcat-solr/webapps
3. Perform the decompression command in the Tomcat/webapps directory and delete the Solr.war
Unzip-oq solr.war-d SOLR
4. Copy dependent jar file
CP solr-4.10.3/example/lib/ext/* tomcat-solr/webapps/solr/web-inf/lib/
5. Create a custom warehouse and copy the SOLR repository to the current directory in SOLR decompression directory
Cp-r SOLR-4.10.3/EXAMPLE/SOLR.
6. Copy the Contrib,dist Dependency class library to the SOLR warehouse
Cp-r SOLR-4.10.3/CONTRIB/SOLR-4.10.3/DIST/SOLR
Modifying the Solrconfig.xml Load Dependency class Library
7. Specify warehouse location, modify tomcat/bin/catalina.sh file, first line add warehouse location
Export java_opts= "-DOLR.SOLR.HOME=/USR/LOCAL/SINGLESOLR/SOLR"
8. Start Tomcat
SH tomcat-solr/bin/startup.sh
Two: IK word breaker
1. Install the IK word breaker to introduce the required jar
2. Introduction of required configuration files
After creating classes, import three configuration files
3. Replace the Schem.xml file
Three: Configure the data import interface
1. The jar to the Lib directory of the index library since the copy
2. Modify the Solrconfig.xml,jar Package
3. In the Solrconfig.xml configuration file, add:
<requesthandler name= "/dataimport"
class= "Org.apache.solr.handler.dataimport.DataImportHandler" >
<lst name= "Defaults" >
<str name= "config" >data-config.xml</str>
</lst>
</requestHandler>
4. Modify the Data-config.xml configuration file
<?xml version= "1.0" encoding= "UTF-8"?>
<dataConfig>
<datasource type= "Jdbcdatasource"
Driver= "Com.mysql.jdbc.Driver"
Url= "Jdbc:mysql://47.104.110.58:3306/haochacang"
User= "HCC"
password= "4*0fmp2rflsxd"/>
<document>
<entity name= "Price" query= "
SELECT
CONCAT (' Product_price ', ' price_id ') as ID,
price_id as product_price_id,
product_id,
grade_id,
attribute_id,
Original_price,
Sell_price,
Discount
from
' Product_price '
WHERE
grade_id!=0
and ' status ' =1
">
<field column= "id" name= "id"/>
<field column= "product_price_id" name= "pp_product_price_id"/>
<field column= "product_id" name= "pp_product_id"/>
<field column= "grade_id" name= "pp_grade_id"/>
<field column= "attribute_id" name= "pp_attribute_id"/>
<field column= "Original_price" name= "Pp_original_price"/>
<field column= "Sell_price" name= "Pp_sell_price"/>
<field column= "discount" name= "Pp_discount"/>
</entity>
</document>
</dataConfig>
solr-Server Installation