Hey All.

I'm running problems with document deletion. I tried to use
DeleteDocuments() and DeleteDocument() methods, both are with problems,
according explained below:


1) DeleteDocuments(term)

This simply doesn't delete anything from the Index. 

//see the code sample:
//"theFieldName" was previously stored as Field.Store.YES and
Field.Index.TOKENIZED.
Term t = new Terms("theFieldName", "theFieldContent");
objIndexReader.DeleteDocuments(t);

I ask: Am I doing anything wrong here? 



2) DeleteDocument(numDoc) <== this problem is a woot problem

After being frustrated ( :P ) with DeleteDocuments(), I ran to test
DeleteDocument(). Then I made a query to return a Hits collection. I did a
loop through the Hits collection and I called DeleteDocument(docNum) for
every document in the Hits collection. 

Lets talk about the problem now..... this method DOES delete a document from
Index, BUT, it is actually deleting wrong documents. I noticed that instead
of deleting the documents found by the Hits collection, it is deleting the
documents based in its insertion order!! 

I mean, if I call objIndexReader.DeleteDocument(0), it will delete the first
document from the entire INDEX, not the first document in the Hits
collection. So, it deleted the first documents I have inserted some days
ago, in previous indexing sessions.

I ask: is there a way to get the correct docNum from the document retrieved
in the Hits collection?
OR: is there a safe way to delete documents
OR: what I'm doing wrong?

Thanks in advance.
Cesar



-- 
View this message in context: 
http://www.nabble.com/Delete-problems----O.O-tp15418663p15418663.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to