lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cesar Ronchese <>
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
Term t = new Terms("theFieldName", "theFieldContent");

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.

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message