lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Mortimer <...@lemurconsulting.com>
Subject delete / optimize question
Date Tue, 17 Sep 2002 21:24:10 GMT
Hi all,

I'm new-ish to Lucene, and having a few problems with document deletion.  
In particular, the point at which a deleted document is no longer visible to
an IndexReader. Is the following scenario sane?

1. Open an IndexReader and delete all docs with Term("name", "Bob"), then
   close the reader.

2. Open an IndexWriter and add various "non-Bob" documents

3. then add a new document with a Term("name", "Bob").  

4. Call optimize()

5. Open an IndexReader and get docFreq for "Bob"


I'd expect the final doc freq to be 1, as all the "Bob" docs should have
been deleted except for the one added in step 3, but instead I'm getting
freq > 1.  

Do I in fact need to do the optimize() step immediately after the deletions,
and before adding any more docs?  This could be expensive with a large
index, and document additions and deletions required in random order.

Thanks for any help!

Tom



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