lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-1593) Optimizations to TopScoreDocCollector and TopFieldCollector
Date Tue, 28 Apr 2009 15:01:31 GMT

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

Michael McCandless commented on LUCENE-1593:
--------------------------------------------

bq. The way I understand it IndexSearcher will call weight.getQuery().scoresDocInOrder() in
the search methods that create a Collector, in order to know whether to create an "in-order"
Collector or "out-of-order" Collector. At this point it does not know whether it will use
the scorer as a top-level or not. Unless we duplicate the logic of doSearch into those methods
(i.e. if there is a filter know it'll be used as a top-level Collector), but I really don't
like to do that.

Yeah you're right, it is in two separate places today.

Though since we are reworking how filters are applied, at that point
it may very well be in one place.

bq. Allowing IS as well as any Collector-creating code to create the right Collector instance
- in/out-of order. That is achievable by adding scoresDocsInOrder() to Query, defaulting to
false (for back-compat) and override in all Query implementations, where it makes sense. For
BQ I think it should remain false, with a TODO to change in 3.0 (see second bullet).

OK let's tentatively move forwards with Query.scoresDocsInOrder.

bq. Clearly separate between BS and BS2, i.e. have BW create one of them explicitly without
wrapping or anything. That is achievable, I think, by adding topScorer() to Weight and call
it from IS. Then in BW we do whatever BS2.scorer(Collector) does today, hopefully we can inline
it in BW. But that can happen only in 3.0. We then change scoresDocsInOrder to return false
only if BQ was set to return docs out of order as well as there are 0 required scorers and
< 32 prohibited scorers (the same logic as in BS2.score(Collector).

OK let's slate this for 3.0, then.

bq. BTW, #2 above does not mean we cannot optimize initCountingSumScorer - if we add start()
to DISI then in BS2 we can override it to initialize CSS, and calling start() from IS.doSearch
before it starts iterating. In score(Collector) it will check if it's initialized only once,
so it should be ok?

OK let's move forwards with this too?

Phew!


> 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