kaivalnp commented on code in PR #12820: URL: https://github.com/apache/lucene/pull/12820#discussion_r1399829328
########## lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java: ########## @@ -155,14 +159,20 @@ protected boolean match(int doc) { } } - protected abstract TopDocs approximateSearch( - LeafReaderContext context, Bits acceptDocs, int visitedLimit) throws IOException; + protected KnnCollector getCollector(LeafReaderContext context, int visitLimit) Review Comment: Agreed, perhaps we can modify the functions a bit to make it cleaner ########## lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java: ########## @@ -171,33 +181,23 @@ protected TopDocs exactSearch(LeafReaderContext context, DocIdSetIterator accept } VectorScorer vectorScorer = createVectorScorer(context, fi); - HitQueue queue = new HitQueue(k, true); - ScoreDoc topDoc = queue.top(); int doc; while ((doc = acceptIterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) { + if (collector.getVisited(doc)) { + continue; + } + boolean advanced = vectorScorer.advanceExact(doc); assert advanced; float score = vectorScorer.score(); - if (score > topDoc.score) { - topDoc.score = score; - topDoc.doc = doc; - topDoc = queue.updateTop(); + if (score > collector.minCompetitiveSimilarity()) { Review Comment: Interesting! Using all available information (like higher scores from some other segment's results) should be beneficial -- 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