benwtrent commented on code in PR #12820: URL: https://github.com/apache/lucene/pull/12820#discussion_r1419374932
########## lucene/core/src/java/org/apache/lucene/search/AbstractKnnCollector.java: ########## @@ -66,4 +69,19 @@ public final int k() { @Override public abstract TopDocs topDocs(); + + @Override + public void prepareScratchState(int maxDoc) { + if (visited == null) { + visited = new FixedBitSet(maxDoc + 1); + } else { + visited = FixedBitSet.ensureCapacity(visited, maxDoc); + visited.clear(); + } + } Review Comment: This is a bad idea, on very large graphs, since we scale logarithmically, sparsebitset would be much better. See: https://github.com/apache/lucene/pull/12789 ########## lucene/core/src/java/org/apache/lucene/search/KnnCollector.java: ########## @@ -85,4 +85,8 @@ public interface KnnCollector { * @return The collected top documents */ TopDocs topDocs(); + + void prepareScratchState(int maxDoc); + + boolean visit(int docId); Review Comment: We are really spreading the API here. I will need to think more on this, I am not sure. -- 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