Saturday, May 31, 2014

Configure Data-Import Handler (DIH) in SOLR

I followed the steps mentioned @: http://wiki.apache.org/solr/DataImportHandler

Data-config.xml
<dataConfig>    
    <dataSource type="JdbcDataSource" name="ds-books" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/test" user="root" password="password"/>    
        <document name="books">        
            <entity name="books" pk="id"   
query="select * from books"   
deltaImportQuery="SELECT * FROM books WHERE id = '${dih.delta.id}'" 
deltaQuery="SELECT  id FROM books WHERE last_modified &gt;  '${dih.last_index_time}'" >
                <field column="id" name="id"  indexed="true" stored="true"/>            
                <field column="NAME" name="name" />            
                <field column="PRICE" name="price" />        
                <field column="last_modified" name="last_modified" />        
            </entity>    
        </document>
</dataConfig>

Command that I am using to execute it is:
http://localhost:8983/solr/dataimport?command=delta-import

dataimport.properties file:
Fri May 10 17:13:18 IST 2013
last_index_time=2013-05-10 17\:13\:18
books.last_index_time=2013-05-10 17\:13\:18
dih.last_index_time=2013-05-10 17\:11\:42

No comments:

Post a Comment

Password Protected Solr Admin Page

As we all know Solr Admin Page is not password protected and anyone can get into Solr Admin Page. However this article will ...