Shalin,

Many thanks for your tip....But it did not seem to help!

Do you think I can use postDeleteImportQuery for this task?

Should I file a bug report?

Cheers,

Bill

--------------------------------------------------
From: "Shalin Shekhar Mangar" <shalinman...@gmail.com>
Sent: Friday, October 16, 2009 1:16 PM
To: <solr-user@lucene.apache.org>
Subject: Re: Using DIH's special commands....Help needed

On Fri, Oct 16, 2009 at 5:54 PM, William Pierce <evalsi...@hotmail.com>wrote:

Folks:

Continuing my saga with DIH and use of its special commands.  I have
verified that the script functionality is indeed working. I also verified
that '$skipRow' is working.    But I don't think that '$deleteDocById' is
working.

My script now looks as follows:

<script>
       <![CDATA[
               function DeleteRow(row) {
                                  var jid = row.get('Id');
                   var jis = row.get('IndexingStatus');
                   if ( jis == 4 ) {
                                      row.put('$deleteDocById', jid);
                                      row.remove('Col1');
                                      row.put('Col1', jid);
                                 }
              return row;
          }
    ]]>
 </script>

The theory is that rows whose 'IndexingStatus' value is 4 should be deleted
from solr index.  Just to be sure that javascript syntax was correct and
checked out, I intentionally overwrite a field called 'Col1' in my schema
with primary key of the document to be deleted.

On a clean and empty index, I import 47 rows from my dummy db. Everything checks out correctly since IndexingStatus for each row is 1. There are no
rows to delete.    I then go into the db and set one row with the
IndexingStatus = 4.   When I execute the dataimport,  I find that all 47
documents are imported correctly.   However,  for the row for which
'IndexingStatus' was set to 4,  the Col1 value is set correctly by the
script transformer to be the primary key value for that row/document.
However,  I should not be seeing that document  since the '$deleteDocById
should have deleted this from solr.

Could this be a bug in solr? Or, am I misunderstanding how $deleteDocById
works?


Would the row which has IndexingStatus=4 also create a document with the
same uniqueKey which you would delete using the transformer? If yes, that
can explain what is happening and you can avoid that by adding a $skipDoc
flag in addition to the $deleteDocById flag.

I know this is a basic question but you are using Solr 1.4, aren't you?

--
Regards,
Shalin Shekhar Mangar.

Reply via email to