I followed the steps mentioned @:
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 > '${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
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 > '${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