Hi Yonik, I believe (another colleague did work around this) the use case is the desire to flush the deletes without having to close the reader and reopen it, which is expensive because of FieldCache population.
Otis ----- Original Message ---- From: Yonik Seeley <[EMAIL PROTECTED]> To: java-dev@lucene.apache.org Sent: Monday, December 11, 2006 3:26:35 PM Subject: Re: Exposing IndexReader commit() Hi Otis, What is your real usecase here? Is it to make sure deletes are flushed in the event of a crash? Otherwise I don't see the problem with delaying deletes. -Yonik http://incubator.apache.org/solr Solr, the open-source Lucene search server On 12/4/06, Otis Gospodnetic <[EMAIL PROTECTED]> wrote: > Hello, > > I'm wondering about opening up commit() in IndexReader. It's currently > "protected". > > We'd like to be able to control the flushing of deletes to disk, and it looks > like that's what IndexReader's commit() does. We tried extending > SegmentReader with our own version that overrides commit() and let's us call > it. This worked for indices with a single segment, because they are read by > SegmentReader. However, this didn't work with multi-segment indices, because > unlike SegmentReader, MultiReader doesn't know how to dynamically load a > custom MultiReader. > Both SegmentReader and MultiReader extend IndexReader, which contains that > protected commit(). > > Next, we thought we'd try extending IndexReader and using our own > IndexReader, but since Segment|MultiReader extend IndexReader directly, I > don't think this approach would work. > > In the end, we just made commit() public in IndexReader, and solved our > problem for both single and multi-segment indices. > > Is there a better way to control flushing to disk without closing and > re-opening an IndexReader, which is more expensive than just commit()ing. > If not, what do you think about making commit() public and javadocing it with > "Expert:...."? > > Thanks, > Otis --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]