escher2k wrote:
Thanks Ryan. I need to use query since I am deleting a range of documents.
From your
comment, I wasn't sure if one doesn't need to do an explicit commit when
using delete by query.
Does delete by query not need an explicit commit.
delete by query causes a commit *before* it executes... I think you
still need one after. From the javadoc:
http://svn.apache.org/repos/asf/lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler2.java
"deleteByQuery causes a commit to happen (close current index writer,
open new index reader) before it can be processed. If deleteByQuery
functionality is needed, it's best if they can be batched and executed
together so they may share the same index reader."
I don't quite know what "batched" means since it only reads one command...
Thanks.
ryan mckinley wrote:
escher2k wrote:
I am trying to remove documents from my index using "delete by query".
However when I did this, the deleted
items seem to remain. This is the format of the XML file I am using -
<delete><query>load_id:20070424150841</query></delete>
<delete><query>load_id:20070425145301</query></delete>
<delete><query>load_id:20070426145301</query></delete>
<delete><query>load_id:20070427145302</query></delete>
<delete><query>load_id:20070428145301</query></delete>
<delete><query>load_id:20070429145301</query></delete>
When I do the deletes individually, it seems to work (i.e. create each of
the above in a separate file). Does this
mean that each delete query request has to be executed separately ?
correct, delete (unlike <add>) only accepts one command.
Just to note, if "load_id" is your unique key, you could also use:
<delete><id>20070424150841</id></delete>
This will give you better performance and does not commit the changes
until you explicitly send <commit/>