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

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

Hmmm .. I think DISI.start() breaks back-compat, since if we optimize the 
scorers to not check if they're initializes in next() and skipTo(), then you'll 
get NPE (or something else will happen). Even if we fix IndexSearcher to call 
start(), someone may still iterate on a Scorer privately, or in a custom code 
(I know I do).

I think this change should go into 3.0 as well, as it's a wider change than I 
though initially. It affects more than just BS2, but all of its internal 
classes, as well as some other Scorers. Also, I see in several scorers 
different TODOs to get rid of that init() check in next() and skipTo(), and so 
this smells like a wider change.

Since it breaks back-compat and the change will affect not just BS/BS2, I 
prefer to leave that optimization out of them for now, and fix it all in 3.0, 
including the other scorers.

So we have two issues for 3.0:
# Introduce start() in DISI and change all the classes that extend DISI to take 
advantage of it, as well as all the code that uses DISI to call start().
# Introduce topScorer() to Weight, and take advantage of it where it makes 
sense (currently we know of BW), and change all the code that calls 
scorer.score(Collector) to request a topScorer() from Weight.

Since Scorer extends DISI these often look to be the same usage, but I think 
they are different, with different use cases. What do you think?

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

Reply via email to