Mailing List Archive

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: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
RE: Is this enought to really delete a document? [ In reply to ]
Hi,
I don't think the documents get deleted right away but rather, are flagged
for deletion. You can see it in the lucene index dir- "deetable" files. They
actually get deleted when the garbage collection takes place or when you
call optimize().

-----Original Message-----
From: Robert A. Decker [mailto:decker@robdecker.com]
Sent: Monday, April 01, 2002 1:49 PM
To: Lucene Users List
Subject: 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:
<mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:lucene-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>