Agreed. I'll see if I can patch it sometime soon. Shai
On Mon, Jun 22, 2009 at 5:05 PM, Michael McCandless < luc...@mikemccandless.com> wrote: > On Mon, Jun 22, 2009 at 9:40 AM, Shai Erera<ser...@gmail.com> wrote: > >> Though, are Lucene's core collectors reusable? If you did really want > >> say 100K results out of each search (very unusual), it'd be nice to > >> not have to throw away the Collector/PQ each time. > > > > PQ has clear(), but it does not really allow you to reuse it, it just > > removes all the elements. So if we want to reuse a PQ, then we need to > add a > > reset() (with a default impl of calling clear()) to both TSDC and PQ. > TSDC > > will delegate the call to PQ, which is actually HitQueue, which will > iterate > > on all the elements and reset them to sentinel values. > > > > TopFieldCollector's reset() will do the same, delegating the call to its > own > > PQ (FieldValueHitQueue), which will do nothing (call clear()). > > > > Do you think it's worth it? If so, should we also add reset() to > Collector? > > Seems like it'd be good to have the option? But it's certainly a very > expert thing since it's presumably rare that one makes such a large > queue to make re-use worthwhile. > > Mike > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-dev-h...@lucene.apache.org > >