lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cesar Ronchese <ronch...@hotmail.com>
Subject Delete problems O.O
Date Mon, 11 Feb 2008 19:19:36 GMT

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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message