lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-1593) Optimizations to TopScoreDocCollector and TopFieldCollector
Date Mon, 27 Apr 2009 18:24:30 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703266#action_12703266
] 

Shai Erera commented on LUCENE-1593:
------------------------------------

bq. he patch still has various logic to handle the sentinel values

Are you talking about TSDC? I thought we agreed that initializing to Float.NEG_INF is reasonable
for TSDC? If not, then I can remove it from there as well as the changes done to PQ.

bq. Maybe we should add a "start()" method to Scorer

Could be useful - but then we should probably do it on DocIdSetIterator with default impl,
and override where it makes sense (BS and BS2)? Also, if we do this, why not adding an end()
too, allowing a DISI to release resources?
And if we document that calling next() and skipTo() without start() before that may result
in an unspecified behavior, it will resemble somewhat to TermPositions, where you have to
call next() before anything else.

However, this should be done with caution. BS2 calls initCountingSumScorer in two places:
(1) next() and skipTo() and (2) score(Collector). Now, in the latter, it first checks if allowDocsOutOfOrder
and if so initializes BS, with adding the Scorers that were added in add(). However those
Scorers *must not be initalized* prior to creating BS, since they will be advanced.
So now it gets tricky - upon call to start(), what should BS2 do? Check allowDocsOutOfOrder
to determine if to initialize or not? And what if it is true but score(Collector) will not
be called, and instead next() and skipTo()?
We should also protect against calling start() more than once, and in Scorers that aggregate
several scorers, we should make sure their start() is called after all Scorers were added
... gets a bit complicated. What do you think?

bq. Also, I fear we need to conditionalize the "don't need to break ties by docID", because
BooleanScorer doesn't visit docs in order?

Yes I kept BS and BS2 in mind ... if we condiionalize anything, it means extra 'if'. If we
want to avoid that 'if', we need to create a variant of the class, which might not be so bad
in TSDC, but will look awful in TFC (additional 6(?) classes).
Perhaps we should still attempt to add to PQ if cmp == 0?
Or did you have something else in mind?

> Optimizations to TopScoreDocCollector and TopFieldCollector
> -----------------------------------------------------------
>
>                 Key: LUCENE-1593
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1593
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>            Reporter: Shai Erera
>             Fix For: 2.9
>
>         Attachments: LUCENE-1593.patch, PerfTest.java
>
>
> 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
numDocs().
> # 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message