lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terry Steichen" <te...@net-frame.com>
Subject Deleting Problem
Date Thu, 01 Aug 2002 14:52:40 GMT
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




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message