jpountz commented on code in PR #14365: URL: https://github.com/apache/lucene/pull/14365#discussion_r1999318407
########## lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java: ########## @@ -251,6 +252,30 @@ public void visit(int docID, byte[] packedValue) { } } + @Override + public void visit(IntsRef ref) { + final int[] docs = ref.ints; + for (int i = ref.offset, to = ref.offset + ref.length; i < to; i++) { + int docID = docs[i]; + if (docID > maxDocVisited) { + adder.add(docID); + } + } + } + + @Override + public void visit(DocIdSetIterator iterator) throws IOException { + assert iterator.docID() == -1; + int docID = iterator.nextDoc(); + if (docID <= maxDocVisited) { + docID = iterator.advance(maxDocVisited + 1); + } + while (docID != DocIdSetIterator.NO_MORE_DOCS) { + adder.add(docID); + docID = iterator.nextDoc(); + } Review Comment: Could it just be a simple loop such as: ``` for (int doc = iterator.advance(maxDocVisited + 1); doc != NO_MORE_DOCS; doc = iterator.nextDoc()) { adder.add(doc); } ``` -- 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