Wednesday, March 29, 2017

Delta Updates in Solr

Tags

Hi Guys,
We have Learned the ways to do indexing from the mysql database those who missed can read from here, Now it’s the time to learn the Delta Imports in Solr .

edit db-data-config.xml from the conf folder ,

<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
<dataSource type="JdbcDataSource"
            driver="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/classicmodels"
            user="root"
            password="root"/>
<document name="classicmodels">
   <entity name="products" query="select * from products" deltaImportQuery="select * from products"
   deltaQuery="select * from products where last_modified > '${dataimporter.last_index_time}'">
     <field column="productCode" name="id"/>
     <field column="productName" name="name"/>
     <field column="productDescription" name="description"/>      
  </entity>
</document>
</dataConfig>

We have already dealt with the  query, now it’s the time to deal with the delta queries now introduce two queries .

deltaImportQuery :this query is used for the importing the data while performing the Delta import, make sure you include all the Fields in deltaImportQuery as like the full import query. If missed any fields solr will through the Run Time Exception.

deltaQuery : this is the query which identifies the Delta Changes . ${dataimporter.last_index_time} will give you te last index time.

Once this changes are done, then it’s the time to index the Delta changes.


Once you hit the above url , then delta import will be done and indexed. You can see the 

status of the delta update by the Following url.



So it’s the time to see the Delta Changes in the response. Happy Learning !!!!


EmoticonEmoticon