lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aruna Raghavan <Aru...@opin.com>
Subject RE: Is this enought to really delete a document?
Date Tue, 02 Apr 2002 16:02:42 GMT
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>


Mime
View raw message