2
votes

I am trying to get a delta import query working for my solr schema. When I do a full import the solr index gets populated correctly. However, when I try and do the delta import, it looks like it processes normally - and gives the following result in the solr gui:

Indexing completed. Added/Updated: 0 documents. Deleted 0 documents.
Requests: 1, Fetched: 0, Skipped: 0, Processed: 0

This is correct, as the database should have no updates since the full query.

However, when I do a full query of the core after the delta update, it shows all the documents are gone, and the core is empty! All of this I am doing through the solr web admin gui.

Here is the delta import handler config file:

<entity name="episode" query="select episode_id from db.episode"
  deltaQuery="select episode_id from db.episode where last_modified &gt; '${dih.last_index_time}'"
  deltaImportQuery="select episode_id from db.episode where episode_id = '${dih.delta.episode_id}'">
</entity>

Here is the relevant stuff in the schema file:

<fields>
    <field name='episode_id' indexed="true" stored="true" type='int' required="true"/>
</fields>

And here is the DIH stuff in my solrconfig.xml:

<lib dir="${solr.install.dir:../../../..}/lib/" regex="mysql-connector-java-5.1.35-bin.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" />
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
  <lst name="defaults">
    <str name="config">episodeDIHconfigfile.xml</str>
  </lst>
</requestHandler>

Any ideas why this would be happening? I thought the delta query would just add to the index, and not just delete everything! All help much appreciated...

1

1 Answers

9
votes

Since you say you're using the admin gui, I'm going to guess that you have that little "clean" checkbox ticked, which means your import starts with the clean flag set to true. Uncheck that box and try again.

If you set clean to true, the entire index is wiped before indexing begins. Very useful for full-imports, but obviously not for deltas!