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>
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>