http://jakarta.apache.org/lucene/docs/api/org/apache/lucene/index/IndexReader.html
says, for delete:

"Deletes the document numbered docNum. Once a document is deleted it will not appear 
in TermDocs or TermPostitions enumerations. Attempts to read its field with the 
document(int) method will result in an error. The presence of this document may still 
be reflected in the docFreq(org.apache.lucene.index.Term) statistic, though this will 
be corrected eventually as the index is further modified."

This is from the delete(int) method rather than delete(Term) but I would
expect that it still holds true.

If you want the deleted documents to really disappear for good, now, optimize
the index.


--
Ian.
[EMAIL PROTECTED]


> [EMAIL PROTECTED] (Terry Steichen) wrote 
>
> I'm having difficulty deleting documents from my index.
> 
> Here's code snippet 1:
> 
>     IndexReader reader = IndexReader.open(index_dir);
>     Term dterm = new Term("pub_date",pub_date);
>     int docs = reader.docFreq(dterm);
>     reader.close();
>     System.out.println("Found "+docs+" docs matching term pub_date = "+pub_date);
> 
> It reports back that I have 48 matching documents.  Then I run code snippet 2:
> 
>     IndexReader reader = IndexReader.open(index_dir);
>     Term dterm = new Term("pub_date",pub_date);
>     int docs = reader.delete(dterm);
>     reader.close();
>     System.out.println("Deleted"+docs+" docs matching term pub_date = "+pub_date);
> 
> It reports back that I deleted 48 documents.  
> 
> But when I run snippet 1 once again, it reports 48 matching documents still exist. 
> 
> If I run snippet 2 again, it reports that it (this time) deleted 0 docs.
> 
> Obviously I'm overlooking something (probably obvious and simple), but I can't seem 
>to delete the selected documents.  Ideas/help would be welcome.
> 
> Regards,
> 
> Terry

----------------------------------------------------------------------
Searchable personal storage and archiving from http://www.digimem.net/

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to