dih-Full Volume Import summary

Source: Internet
Author: User


1, copy Solr-dataimporthandler-4.10.4.jar, Mysql-connector-java-5.1.23.jar to/web-inf/lib/

2, modify Home\solr\collection1\conf\solrconfig.xml, Schema.xml, create Data-config.xml
Solrconfig.xml Add the following content:
<!--add by Sniper data import, full index--
<requesthandler name= "/dataimport"
class= "Org.apache.solr.handler.dataimport.DataImportHandler" >
<lst name= "Defaults" >
<str name= "config" >data-config.xml</str>
</lst>
</requestHandler>

Schema.xml Add the following content:
ID, name is used with:
<field name= "nickname" Type= "Text_ik" indexed= "true" stored= "true"/>

Data-config.xml content is as follows:
<dataConfig>
<datasource name= "jdbc" type= "Jdbcdatasource" driver= "Com.mysql.jdbc.Driver"
Url= "Jdbc:mysql://localhost:3306/my"
user= "root" password= "123456"/>

<document name= "My_data" >
<entity name= "Test_data"
pk= "C_ID"
query= "Select c_id, C_name, c_nickname from T_test limit ${dataimporter.request.begin}, ${dataimporter.request.length} "
>

<field column= "c_id" name= "id"/>
<field column= "C_name" name= "name"/>
<field column= "C_nickname" name= "nickname"/>
</entity>
</document>
</dataConfig>


3. Start Tomcat

4, in the browser access:
Http://localhost:8080/solr/collection1/dataimport?command=full-import&commit=true&clean=true&begin =0&length=10

5, or on the page operation:

dih-Full Volume Import summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.