Tags: art data type Def bin other source name URL products
1, download Solr:wget http://archive.apache.org/dist/lucene/solr/7.3.0/solr-7.3.0.tgz or go to the official website yourself under: http://archive.apache.org /dist/lucene/solr/look for the following image to enter the selected version
2, Decompression SOLR command: TAR-ZXVF solr-7.3.0.tgz-c/usr/local/software/-C Specify the path to extract to
3. Start SOLR command: BIN/SOLR Start-force before this there are two practices (1, direct start but will error it will create a directory 2, first create a directory, and then add the core here to note that two locations to be consistent with the core name you created)
3.1 Locate the following path create a new directory without FTP You can use the command to enter/SERVER/SOLR in the decompression SOLR location creating a custom directory This directory is equivalent to the core under 4.10.3 solrhome
3.2 Copy the following path to the two folder to 3.1 steps you created under the directory (this specific is a bit dizzy a lot of information said a lot of directories I do not know to use that but pay attention to the contents of Conf directory )
The above SORL basic configuration is completed to verify whether the successful look on the line if there is no indication of the location of unsuccessful
4. Configure Chinese parser Download Chinese parser Ik-analyzer-solr7-7.x.jar add to/usr/local/software/solr-7.3.0/server/solr-webapp/webapp/web-inf/ Lib under said to have their own don't know how to configure
5. Open the Managed-schema configuration to configure the following code
class= "SOLR." TextField "> <analyzer type=" index "> class=" Org.wltea.analyzer.lucene.IKTokenizerFactory "usesmart=" false "conf=" ik.conf "/> class=" SOLR. Lowercasefilterfactory "/> </analyzer> <analyzer type=" Query "> class=" Org.wltea.analyzer.lucene.IKTokenizerFactory "usesmart=" true "conf=" ik.conf "/> class=" SOLR. Lowercasefilterfactory "/> </analyzer></fieldType>
6. Restart SOLR command: BIN/SOLR restart-force
7. Configure MySQL solr-dataimporthandler-7.3.0.jar and solr-dataimporthandler-extras-7.3.0. Jar and Mysql-connector-java-5.1.46.jar put it in Solr-7.3.0/server/solr-webapp/webapp/web-inf/lib.
MySQL himself under Solr-dataimporthandler-7.3.0.jar and Solr-dataimporthandler-extras-7.3.0.jar in/solr-7.3.0/ Dist below is copied to Solr-7.3.0/server/solr-webapp/webapp/web-inf/lib
8. Enter the core/conf you created to open the Managed-schema command: VI solrconfig.xml Add the following code to the last side of the RequestHandler
class= "Org.apache.solr.handler.dataimport.DataImportHandler" > <lst name= "Defaults" > <str name= "config" >data-config.xml</str> </lst> </requestHandler>
9. Create Data-config.xml content in the same category as below
<?xml version= "1.0" encoding= "UTF-8"?>
<datasource type= "Jdbcdatasource"
< write SQL statements in!--query--
<entity name= "Product"
query= "Select Pid,name,catalog,catalog_name,price,description,picture from Products" >
<!--column names in the corresponding database, name is the corresponding domain name (configuration is required in scheme, that is, set the business system domain), This is a mapping relationship --
<field column= "pid" name= "id"/>
<field column= "name" name= "Product_Name"/>
<field column= "Catalog" name= "Product_catalog"/>
<field column= "Catalog_name" name= "Product_catalog_name"/>
<field column= "Price" name= "Product_price"/>
<field column= "description" name= "Product_description"/>
<field column= "Picture" name= "Product_picture"/>
10, write Managed_schema
Managed_schema defines a number of domains, in fact, using the fields in Lucene.
What is a domain? The role of a domain is to define what type of field is in a SOLR index, what to do, and how to do it. A bit like the type of field in the database. But the meaning of the expression is more abundant.
Add the following code after Managed_schema:
<field name= "Product_Name" type= "Text_ik" indexed= "true" stored= "true"/>
<field name= "Product_catalog" type= "string" indexed= "true" stored= "true"/>
<field name= "Product_catalog_name" type= "string" indexed= "true" stored= "true"/>
<field name= "Product_price" type= "Pfloat" indexed= "true" stored= "true"/>
<field name= "product_description" type= "Text_ik" indexed= "true" stored= "false"/>
<field name= "Product_picture" type= "string" indexed= "false" stored= "true"/>
<field name= "Product_keywords" type= "Text_ik" indexed= "true" stored= "false" Mult ivalued= "true"/>
The name of this field, which needs to be unique and not duplicated throughout the Managed_schema file, is defined as the name of the database table field and is easy to use. Of course, it can also be defined as other names.
Type is what this field is typed in, string is a string type, int is the shaping data type, and date is the time type, which is equivalent to the timestamp in the database.
Indexed indicates whether the index, the index can be queried, otherwise, the search will not appear.
Stored indicates whether it is stored inside the index library.
11. The test is successful
12. Stop SOLR command: BIN/SOLR stop-all
13. Uninstall SOLR directly delete SOLR root directory restart virtual machine
CentOS 7 Installation solr7.3.0 configuration MySQL