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

Greg Miller commented on LUCENE-10258:
--------------------------------------

[~sokolov] yep, exactly. I poked around at direct usage of this in the Lucene 
codebase and didn't see any immediate opportunities. The usages tended to wrap 
a Scorable and then just use the DV (never calling #score() directly on the 
Scorable). So all the usages within the Lucene codebase look optimal to me 
(except for test cases, but that's not really relevant).

I'll go ahead and add a javadoc comment though to this factory method 
suggesting that users wrap their Scorable with a ScoreCachingWrappingScorer if 
they intend to call score() directly on the Scorable to at least provide the 
suggestion to usages outside of the Lucene package.

> DoubleValuesSource#fromScorer() should leverage ScoreCachingWrappingScorer
> --------------------------------------------------------------------------
>
>                 Key: LUCENE-10258
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10258
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/search
>            Reporter: Greg Miller
>            Assignee: Greg Miller
>            Priority: Minor
>
> DoubleValuesSource#fromScorer() is a helper method for wrapping a Scorable in 
> a DoubleValues instance (providing the value of Scorable#score() as its 
> value). It would be nice to leverage ScoreCachingWrappingScorer for this 
> use-case to avoid unnecessarily recomputing the score if the Scorable is 
> being used elsewhere.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to