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

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

{quote}
IndexSearcher creates the Collector before it obtains a Scorer. Therefore all 
it has at hand is the Weight. Since Weight is an interface, we can't change it, 
so I added it to Query with a default of false.
{quote}

In early iterations on LUCENE-1483, we allowed Collector.setNextReader
to return a new Collector on the possibility that a new segment might
require different collector.

We could consider going back to that... and allowing the builtin
collectors to receive a Scorer on creation, which they could interact
with to figure out in/out of order types of issues.  We could then
also enrich setNextReader a bit to also receive a Scorer, so that if
somehow the Scorer for the next segment switched to be in-order vs
out-of-order, the Collector could properly "respond".

Or we could require "homogeneity" for Scorer across all segments
(which'd be quite a bit simpler).

{quote}
Why not reverse the flow of information and tell the Weight.scorer() method if 
an out-of-order scorer is acceptable via some flags or a context object. This 
is also not backward compatible because Weight is an interface, so perhaps this 
optimization will just have to wait.
{quote}

I tentatively like this approach, ie add an API to Collector for it to
declare if it can handle out-of-order collection, and then ask for the
right Scorer.

But still internal creation of Collectors could go both ways, and so
we should retain the freedom to optimize (the BooleanScorer example
above).


> 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, 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to