Solr and Mysql integrate Solr with Mysql to create full indexes and incremental indexes. The basic principle is simple: Register Solr DataImportHandler in the solr project and configure the Mysql data source and Data Query SQL statement. Solr calls
Solr and Mysql integrate Solr with Mysql to create full indexes and incremental indexes. The basic principle is simple: Register Solr DataImportHandler in the solr project and configure the Mysql data source and Data Query SQL statement. Solr calls
Simple Integration of Solr and Mysql
The integration of Solr and Mysql Databases allows you to create full and incremental indexes.
The basic principle is simple: Register Solr DataImportHandler in the solr project and configure the Mysql data source and Data Query SQL statement. When we use the Solr background to control the page or directly access an address (provided later), Solr will call DataImportHandler to connect to the database, query data based on SQL statements, and create an index.
Solr version: solr4.3.1
Specify the Solr installation directory, for example, E: \ environment \ solr-4.3.1 is solr-home.
1. Copy the jar package
Copy the jar package of DataImportHandler and the mysql database driver package to the solr-home/dist directory. By default, the directory contains two jar packages required by DataImportHandler. The jar package name for this Solr version is: solr-dataimporthandler-4.3.1.jar, solr-dataimporthandler-extras-4.3.1.jar
2. Modify the solr-home \ example \ solr \ collection1 \ conf \ solrconfig. xml file.
A. Add the required jar package reference Configuration:
B. Add resultHandler Configuration
data-config.xml
3. Create a data-config.xml file under the same directory of solrconfig. xml, configure the database connection and the correspondence between Solr and mysql DATA and query statements.
4. Restart Solr.
Batch import (full-import ):
Http :// : /Solr/dataimport? Command = full-import & commit = y
Incremental import (delta-import ):
Http :// : /Solr/dataimport? Command = delta-import & commit = y
Import status query (status ):
Http :// : /Solr/dataimport
Reload-config ):
Http :// : /Solr/dataimport? Command = reload-config
Terminate import (abort ):
Http :// : /Solr/dataimport? Command = abort