lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-1593) Optimizations to TopScoreDocCollector and TopFieldCollector
Date Thu, 30 Apr 2009 12:20:30 GMT


Shai Erera commented on LUCENE-1593:

bq. BTW, I wonder if instead of "Query.scoresDocsInOrder" we should allow one to ask the Query
for either/or? 

I'm afraid this might mean a larger change. What will TermQuery do? Today it returns true,
and does not have any implementation that can return docs out-of-order. So what should TQ
do when outOfOrderScorer is called? Just return what inOrderScorer returns, or throw an exception?

That that there might be a Collector out there that requires docs in order is not something
I think we should handle. Reason is, there wasn't any guarantee until today that docs are
returned in order. So how can somehow write a Collector which has a hard assumption on that?
Maybe only if he used a Query which he knows always scores in order, such as TQ, but then
I don't think this guy will have a problem since TQ returns true.

And if that someone needs docs in order, but the query at hand returns docs out of order,
then I'd say tough luck :)? I mean, maybe with BQ we can ensure in/out of order on request,
but if there will be a query which returns docs in random, or based on other criteria which
causes it to return out of order, what good will forcing it to return docs in order do? I'd
say that you should just use a different query in that case?

bq. But I'm not sure in practice when one would want to use an out-of-order non-top iterator.

I agree. I think that iteration on Scorer is dictated to be in order because it extends DISI
with next() and skipTo() methods which don't imply in any way they can return something out
of order (besides next() maybe, but it will be hard to use such next() with a skipTo()).

> 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