You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by manuel aldana <al...@gmx.de> on 2011/01/31 09:40:27 UTC

data-config.xml: delta-import unclear behaviour pre/postDeleteImportQuery with clean

I have some unclear behaviour with using clean and 
pre/postImportDeleteQuery for delta-imports. The docs under 
http://wiki.apache.org/solr/DataImportHandler#Configuration_in_data-config.xml 
are not clear enough.

My observation is:
- preImportDeleteQuery is only executed if clean=true is set
- postImportDeleteQuery is only executed if clean=true is set
- if preImportDeleteQuery is ommitted and clean=true then the whole 
index is cleaned
=> config with postImportDeleteQuery itself won't work

Is above correct?

I don't need preImportDeleteQuery only post is necessary. But to make 
post work I am doubling the post to pre so clean=true doesn't delete 
whole index. This looks a bit like a workaround as wanted behaviour.

solr version is 1.4.1

thanks.

-- 
  manuel aldana
  mail: aldana@gmx.de | manuel@aldana-online.de
  blog: www.aldana-online.de


RE: data-config.xml: delta-import unclear behaviour pre/postDeleteImportQuery with clean

Posted by "Charton, Andre" <ac...@ebay-kleinanzeigen.de>.
Hi Manu,

from 1.4.1 it is invoked if "postImportDeleteQuery" is not null and clean is true, see Code

...
String delQuery = e.allAttributes.get("preImportDeleteQuery");
      if (dataImporter.getStatus() == DataImporter.Status.RUNNING_DELTA_DUMP) {
        cleanByQuery(delQuery, fullCleanDone);
        doDelta();
        delQuery = e.allAttributes.get("postImportDeleteQuery");
        if (delQuery != null) {
          fullCleanDone.set(false);
          cleanByQuery(delQuery, fullCleanDone);
        }
      }
...


private void cleanByQuery(String delQuery, AtomicBoolean completeCleanDone) {
    delQuery = getVariableResolver().replaceTokens(delQuery);
    if (requestParameters.clean) {
      if (delQuery == null && !completeCleanDone.get()) {
        writer.doDeleteAll();
        completeCleanDone.set(true);
      } else if (delQuery != null) {
        writer.deleteByQuery(delQuery);
      }
    }
  }

André



-----Original Message-----
From: manuel aldana [mailto:aldana@gmx.de] 
Sent: Montag, 31. Januar 2011 09:40
To: solr-user@lucene.apache.org
Subject: data-config.xml: delta-import unclear behaviour pre/postDeleteImportQuery with clean

I have some unclear behaviour with using clean and 
pre/postImportDeleteQuery for delta-imports. The docs under 
http://wiki.apache.org/solr/DataImportHandler#Configuration_in_data-config.xml 
are not clear enough.

My observation is:
- preImportDeleteQuery is only executed if clean=true is set
- postImportDeleteQuery is only executed if clean=true is set
- if preImportDeleteQuery is ommitted and clean=true then the whole 
index is cleaned
=> config with postImportDeleteQuery itself won't work

Is above correct?

I don't need preImportDeleteQuery only post is necessary. But to make 
post work I am doubling the post to pre so clean=true doesn't delete 
whole index. This looks a bit like a workaround as wanted behaviour.

solr version is 1.4.1

thanks.

-- 
  manuel aldana
  mail: aldana@gmx.de | manuel@aldana-online.de
  blog: www.aldana-online.de