2

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...

Tom O'Brien
  • 1,741
  • 9
  • 45
  • 73

1 Answers1

9

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!

TMBT
  • 1,183
  • 10
  • 17
  • Genius TMBT! You are a genius! – Tom O'Brien Feb 08 '16 at 20:35
  • @TMBT I have same configuration but all 0 in response Requests: 0, Fetched: 0, Skipped: 0, Processed: 0, Please let me know the reason. If you want I can post the question, – Kamini Nov 29 '16 at 16:53
  • @Kamini This could be due to one or more problems. You'll need to post a question. – TMBT Nov 29 '16 at 21:45
  • @TMBT .I have added new question .Please find link as below-http://stackoverflow.com/questions/40881185/solr-delta-import-query-is-not-working – Kamini Nov 30 '16 at 05:49
  • Why the hell this is actually not ignored for delta, nor the checkbox in the gui is not disabled for delta? – maslan Dec 22 '16 at 14:29