gsmiller commented on code in PR #11928: URL: https://github.com/apache/lucene/pull/11928#discussion_r1026694386
########## lucene/core/src/java/org/apache/lucene/search/DisjunctionDISIApproximation.java: ########## @@ -45,29 +51,54 @@ public long cost() { @Override public int docID() { - return subIterators.top().doc; + return docID; } - @Override - public int nextDoc() throws IOException { + private int doNext(int target) throws IOException { + if (target == DocIdSetIterator.NO_MORE_DOCS) { + docID = DocIdSetIterator.NO_MORE_DOCS; + return docID; + } + DisiWrapper top = subIterators.top(); - final int doc = top.doc; do { - top.doc = top.approximation.nextDoc(); + top.doc = top.approximation.advance(target); + if (top.doc == target) { + subIterators.updateTop(); + docID = target; + return docID; + } top = subIterators.updateTop(); - } while (top.doc == doc); + } while (top.doc < target); + docID = top.doc; - return top.doc; + return docID; + } + + @Override + public int nextDoc() throws IOException { + if (docID == DocIdSetIterator.NO_MORE_DOCS) { + return docID; + } Review Comment: Right, good point. Will simplify. -- 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