You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Robert A. Decker" <de...@robdecker.com> on 2002/04/01 21:48:57 UTC

Is this enought to really delete a document?

I use the following code to delete a doc from the index. 'id' is a string
unique to each document:

Term term = new Term("id", this.entityIdString());
IndexReader reader = IndexReader.open(pathToIndex);
int numDeleted = reader.delete(term);
reader.close();

However, when on the next pass I reindex a document with the same id, and
then check how many times it's in the index, I'm now told that the
document appears in the index twice.

Here's how I get the count of the document in the index:

Term term = new Term("id", this.entityIdString());
IndexReader reader = IndexReader.open(pathtoIndex);
int docFreq = reader.docFreq(term);


thanks,
rob

http://www.robdecker.com/
http://www.planetside.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>