gsmiller commented on code in PR #12560: URL: https://github.com/apache/lucene/pull/12560#discussion_r1327831100
########## lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionValueSource.java: ########## @@ -90,16 +90,24 @@ public DoubleValues getValues(LeafReaderContext readerContext, DoubleValues scor static DoubleValues zeroWhenUnpositioned(DoubleValues in) { return new DoubleValues() { - boolean positioned = false; + int currentDoc = -1; + double value; + boolean computed = false; @Override public double doubleValue() throws IOException { - return positioned ? in.doubleValue() : 0; + if (computed == false) { + value = in.advanceExact(currentDoc) ? in.doubleValue() : 0; + computed = true; + } + return value; } @Override - public boolean advanceExact(int doc) throws IOException { - return positioned = in.advanceExact(doc); + public boolean advanceExact(int doc) { + currentDoc = doc; Review Comment: Thanks for the suggestion. I'll include that logic. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org