lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Commented: (LUCENE-1593) Optimizations to TopScoreDocCollector and TopFieldCollector
Date Fri, 01 May 2009 15:22:31 GMT


Michael McCandless commented on LUCENE-1593:

bq. Unless we assume that OUT_OF_ORDER covers DONT_CARE either

I think this is the case?  Ie a boolean suffices.

For Collector that boolean means "can accept docs out of order".
For the Scorer it means "might deliver docs out of order".

bq. Where Collector is given as argument, ask it if it about orderness and create the appropriate

Good.  And default Collector.acceptsDocsOutOfOrder should return

bq. Where we create our own Collector (i.e. TFC and TSDC) decide on our own what is better.
Maybe always ask out-of-order? That way a Query which doesn't only supports in-order without
any optimization for out-of-order can return that in-order collector. I didn't think of it
initially, but Mike is right - every in-order scorer is also an out-of-order scorer, so this
should be fine.

I think this is good, though we should 1) ask the Scorer for an
out-of-order Scorer, but then once we get the resulting scorer back we
should 2) ask that instance if in fact it will ever return
out-of-order (all except BS will not), and then 3) pick a collector
that's optimized for in-order collection if the scorer always
returns in-order docs.

The big problem is the fact that we get Scorers per segment, but
Collector once.  Actually it may not be a problem: maybe for the first
segment we do the logic above, but then for subsequent segments we
explictly ask for an in-order Scorer if the first one was in-order?
Ie we can enforce homogeneity ourselves?

This would require deferring creating the Collector until we've seen
the Scorer for the first segment.

> Optimizations to TopScoreDocCollector and TopFieldCollector
> -----------------------------------------------------------
>                 Key: LUCENE-1593
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>            Reporter: Shai Erera
>             Fix For: 2.9
>         Attachments: LUCENE-1593.patch, LUCENE-1593.patch,
> This is a spin-off of LUCENE-1575 and proposes to optimize TSDC and TFC code to remove
unnecessary checks. The plan is:
> # Ensure that IndexSearcher returns segements in increasing doc Id order, instead of
> # Change TSDC and TFC's code to not use the doc id as a tie breaker. New docs will always
have larger ids and therefore cannot compete.
> # Pre-populate HitQueue with sentinel values in TSDC (score = Float.NEG_INF) and remove
the check if reusableSD == null.
> # Also move to use "changing top" and then call adjustTop(), in case we update the queue.
> # some methods in Sort explicitly add SortField.FIELD_DOC as a "tie breaker" for the
last SortField. But, doing so should not be necessary (since we already break ties by docID),
and is in fact less efficient (once the above optimization is in).
> # Investigate PQ - can we deprecate insert() and have only insertWithOverflow()? Add
a addDummyObjects method which will populate the queue without "arranging" it, just store
the objects in the array (this can be used to pre-populate sentinel values)?
> I will post a patch as well as some perf measurements as soon as I have them.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message