Search code examples
solrsolr4solrcloud

DIH in SOLR based on primary key of a table


currently am using DIH for pulling data from MSSQL server to SOLR. Where in am using dataimporter.last_index_time to pull the records which are into database only after last_index_time. So i was exploring if there are any other option for DIH to use instead of using last_index_time may be something like last_pk_id. Is such option available? could anyone let me know.


Solution

  • not provided by Solr itself.

    But nothing prevents you from doing this:

    1. set your DIH sql for the delta like this: WHERE (last_pk_id > '${dataimporter.request.LAST_PK_ID}')
    2. when you run some indexing, store, outside Solr, the last_pk_id value you indexed, say 333.
    3. next time you need to delta index, add to your request ...&clean=false&LAST_PK_ID=333
    4. store your new LAST_PK_ID (you can query solr for this)