iverase commented on code in PR #13948: URL: https://github.com/apache/lucene/pull/13948#discussion_r1877891198
########## lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesReader.java: ########## @@ -383,17 +392,31 @@ public long cost() { @Override public int advance(int target) throws IOException { - return docsWithField.advance(target); + int doc = docsWithField.advance(target); + if (doc != NO_MORE_DOCS) { + consume(values.apply(doc)); + } + return doc; + } + + private void consume(BytesRef bytesRef) { + bytes.reset(bytesRef.bytes); + inputRef.offset = bytesRef.offset; + inputRef.length = bytesRef.length; } @Override public boolean advanceExact(int target) throws IOException { - return docsWithField.advanceExact(target); + if (docsWithField.advanceExact(target)) { + consume(values.apply(target)); + return true; + } + return false; } @Override - public BytesRef binaryValue() throws IOException { - return values.apply(docsWithField.docID()); + public RandomAccessInputRef randomAccessInputValue() { + return inputRef; Review Comment: None, I rework it so we call `values#apply` only in `randomAccessInputValue()` -- 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