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

Adrien Grand commented on LUCENE-8405:
--------------------------------------

Thanks Mike and David for looking!

bq. Why does MaxScoreCollector.scoreMode() return COMPLETE instead of 
TOP_SCORES?

It saves wrapping of the scorer since Scorer.setMinCompetitiveScore can't be 
used with multi-collectors in general. I will add a comment. Or I can change it 
if you think it's clearer.

> Remove TopHits.maxScore
> -----------------------
>
>                 Key: LUCENE-8405
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8405
>             Project: Lucene - Core
>          Issue Type: Task
>            Reporter: Adrien Grand
>            Priority: Major
>             Fix For: master (8.0)
>
>         Attachments: LUCENE-8405.patch, LUCENE-8405.patch
>
>
> I would like to propose removing TopDocs.maxScore. The reasoning is that 
> either you are sorting by score and then its value is easy to access via the 
> score of the best hit. Or you sort by one or more fields and computing it is 
> wasteful:
>  - term frequencies and norms need to be read and decoded for every match
>  - scores need to be computed on every match
>  - early-termination optimizations are disabled
> It would be more efficient to collect hits twice: once with scores disabled 
> to get the top hits, and once to get the best score which would run 
> efficiently thanks to impacts and MAXSCORE, especially with a size of 1:
> {code:java}
> TopDocs topHits = searcher.search(query, 1);
> float maxScore = topHits.scoreDocs.length == 0 ? Float.NaN : 
> topHits.scoreDocs[0].score;
> {code}
> The {{doDocScores}} option of TopFieldCollector has drawbacks as well but at 
> least doesn't disable early-termination optimizations and doesn't require 
> scores to be computed on every hit.
> As this would be a significant breaking change, I'm targeting 8.0.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to