SOLR Implements incremental indexing

Source: Internet
Author: User
Tags solr import database

In the above scenario, the SOLR configuration and the import database have been successful, and we have implemented the SOLR incremental indexing functionality.

Detailed steps:

1, add a Date Type field to the table in the database, my field name is Createtime;

2. Modify the Solr-date-config.xml file as follows

<dataConfig>
<datasource password= "1234" user= "sa" url= "jdbc:sqlserver://127.0.0.1:1433;databasename=ssh"//database to be connected and user name password Database driver driver= "Com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<document name= "Info" pk= "id" >
<entity name= "Zpxx" transformer= "Clobtransformer" pk= "id"
query= "SELECT * from Users"//query: Querying database tables to match record data
deltaimportquery= "Select Id,name, pwd from SSH.dbo.users where id = ' ${dih.delta.id} '"//Incremental index query imported data
deltaquery= "SELECT ID from Users where createtime > ' ${dataimporter.last_index_time} '">//deltaquery: Incremental index query primary key ID

<field name= "id" column= "id"/>
<field name= "name" column= "name"/>
<field name= "pwd" column= "pwd"/>
<filed name= "Createtime" coiumn= "Createtime"/>
</entity>
</document>
</dataConfig>

3, in the schema. The Createtime field in the XML file that you just added

<field name= "Createtime" type= "date" indexed= "true" stored= "true" multivalued= "false"/>

4, the new data inserted in the database, and then in the SOLR home using command = Delta Import Import data, and then in query to see whether the data can be queried, if it is successful, if not, then check the configuration file there is a problem.

SOLR Implements incremental indexing

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.