Connect Solr-4.10.2 with Tomcat integration.
1.Add the Data Import node to the Solrconfig.xml, and the Solrconfig.xml path is D:\solr\data\solr\collection1\conf\solrconfig.xml.
<requesthandler name= "/dataimport" class= "Org.apache.solr.handler.dataimport.DataImportHandler" >
<lst name= "Defaults" >
<str name= "config" >data-config.xml</str>
</lst>
</requestHandler>
2.Create a new data-config.xml in the D:\solr\data\solr\collection1\conf directory with the following content:
<dataConfig>
<datasource type= "Jdbcdatasource"
driver= "Com.mysql.jdbc.Driver"
url= "Jdbc:mysql://192.98.12.55:3306/test"
user= "Root"
password= "root"/>
<document>
<entity name= "solr_test" transformer= "Dateformattransformer "
query= "Select f_id, F_content, f_note_time from Note_info" >
<field column= ' f_id ' name= ' id '/>
<field column= ' f_note_time ' datetimeformat= ' yyyy-mm-dd HH:mm:ss '/>
<field column= ' f_content ' name= ' f_content '/>
</entity>
</document>
</dataConfig>
3.Copy D:\solr\solr-4.10.2\ Solr-dataimporthandler-4.10.2.jar and Solr-dataimporthandler-extras-4.10.2.jar to Tomcat\webapps\solr\web-inf in the Dist directory The \lib directory. and the corresponding database-driven jar.
4.The modified Schema.xml,schema.xml is located in D:\solr\data\solr\collection1\conf\. Add the following nodes
<field name= "F_note_time" type= "date" stored= "true"/>
<field name= "f_content" type= "Text_general" indexed= "true" stored= "true"/>
5.Login Solradmin Import data
Parameter description: The clean option refers to whether to delete data that does not match. That is, not in the database select result, but the SOLR Index library exists, then delete.
6 . View Imported Data
If you do not see the imported data, you can view the troubleshooting.
SOLR Import Database Data