jpountz commented on a change in pull request #746: LUCENE-8885: Optimise BKD reader by exploiting cardinality information stored on leaves URL: https://github.com/apache/lucene-solr/pull/746#discussion_r298140894
########## File path: lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java ########## @@ -780,4 +783,43 @@ public int getDocCount() { public boolean isLeafNode(int nodeID) { return nodeID >= leafNodeOffset; } + + protected static class BKDReaderDocIDSetIterator extends DocIdSetIterator { + + int idx; + int length; + int offset; + int[] docIds; + + public BKDReaderDocIDSetIterator(int maxPointsInLeafNode) { + this.docIds = new int[maxPointsInLeafNode]; + } + + @Override + public int docID() { + if (idx == -1) { + return -1; + } + return docIds[offset + idx]; + } + + @Override + public int nextDoc() throws IOException { + if (idx == length - 1) { + return DocIdSetIterator.NO_MORE_DOCS; + } + idx++; + return docIds[offset + idx]; + } + + @Override + public int advance(int target) throws IOException { + throw new UnsupportedOperationException(); Review comment: I think it'd be better to support it, even if slow. Eg. you can return `slowAdvance(target)`. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org