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

David Smiley commented on LUCENE-8103:
--------------------------------------

FWIW I find GitHub easier to conduct a code review.  If you switch to that, 
please first commit what you have here and then after make changes so I can see 
what you did from iteration to iteration.

minor: I suggest using the variable name "disi" for a DocIdSetIterator as this 
choice is quite common elsewhere.

In DoubleValueSource I think it'd be better to declare the state you need like 
tpi, disi inside the anonymous DoubleValues class to keep the scope smaller and 
to reduce extra hidden indirection that I think Java adds.  Also declare final 
where applicable.  scorerMatch boolean is confusing to me; and I think the 
initial value as written doesn't matter either.  I suggest renaming this to 
thisDocMatches, initialize to false (since we are unpositioned at the start), 
and then update it appropriately.  The logic you have now around scoreMatch 
seems to do maybe extra work and/or isn't as simple as it could be.   If 
doubleValue is invoked and not thisDocMatches then don't delegate to the 
scorer, which is probably invalid.  Return NaN.

In QueryValueSource.exists, maybe you could improve this a bit to be simpler; I 
find the way it was written prior to be confusing.

> QueryValueSource should use TwoPhaseIterator
> --------------------------------------------
>
>                 Key: LUCENE-8103
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8103
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/other
>            Reporter: David Smiley
>            Priority: Minor
>         Attachments: LUCENE-8103.patch, LUCENE-8103.patch
>
>
> QueryValueSource (in "queries" module) is a ValueSource representation of a 
> Query; the score is the value.  It ought to try to use a TwoPhaseIterator 
> from the query if it can be offered. This will prevent possibly expensive 
> advancing beyond documents that we aren't interested in.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to