You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by be...@apache.org on 2025/01/22 13:59:40 UTC
(lucene) branch branch_10x updated: move MultiLeafKnnCollector to decorator and remove unnecessary code (#14147)
This is an automated email from the ASF dual-hosted git repository.
benwtrent pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new fc8b9ff1629 move MultiLeafKnnCollector to decorator and remove unnecessary code (#14147)
fc8b9ff1629 is described below
commit fc8b9ff162923ddba631d97f81e8e1c83b5da1c2
Author: Benjamin Trent <be...@gmail.com>
AuthorDate: Wed Jan 22 08:31:12 2025 -0500
move MultiLeafKnnCollector to decorator and remove unnecessary code (#14147)
---
.../lucene/search/knn/MultiLeafKnnCollector.java | 34 ++--------------------
1 file changed, 2 insertions(+), 32 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/search/knn/MultiLeafKnnCollector.java b/lucene/core/src/java/org/apache/lucene/search/knn/MultiLeafKnnCollector.java
index 051cd9ed633..6b5e398d708 100644
--- a/lucene/core/src/java/org/apache/lucene/search/knn/MultiLeafKnnCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/knn/MultiLeafKnnCollector.java
@@ -19,7 +19,6 @@ package org.apache.lucene.search.knn;
import org.apache.lucene.search.AbstractKnnCollector;
import org.apache.lucene.search.KnnCollector;
-import org.apache.lucene.search.TopDocs;
import org.apache.lucene.util.hnsw.BlockingFloatHeap;
import org.apache.lucene.util.hnsw.FloatHeap;
@@ -29,7 +28,7 @@ import org.apache.lucene.util.hnsw.FloatHeap;
*
* @lucene.experimental
*/
-public final class MultiLeafKnnCollector implements KnnCollector {
+public final class MultiLeafKnnCollector extends KnnCollector.Decorator {
// greediness of globally non-competitive search: (0,1]
private static final float DEFAULT_GREEDINESS = 0.9f;
@@ -77,6 +76,7 @@ public final class MultiLeafKnnCollector implements KnnCollector {
int interval,
BlockingFloatHeap globalSimilarityQueue,
AbstractKnnCollector subCollector) {
+ super(subCollector);
if (greediness < 0 || greediness > 1) {
throw new IllegalArgumentException("greediness must be in [0,1]");
}
@@ -91,31 +91,6 @@ public final class MultiLeafKnnCollector implements KnnCollector {
this.updatesScratch = new float[k];
}
- @Override
- public boolean earlyTerminated() {
- return subCollector.earlyTerminated();
- }
-
- @Override
- public void incVisitedCount(int count) {
- subCollector.incVisitedCount(count);
- }
-
- @Override
- public long visitedCount() {
- return subCollector.visitedCount();
- }
-
- @Override
- public long visitLimit() {
- return subCollector.visitLimit();
- }
-
- @Override
- public int k() {
- return subCollector.k();
- }
-
@Override
public boolean collect(int docId, float similarity) {
boolean localSimUpdated = subCollector.collect(docId, similarity);
@@ -157,11 +132,6 @@ public final class MultiLeafKnnCollector implements KnnCollector {
Math.min(nonCompetitiveQueue.peek(), cachedGlobalMinSim));
}
- @Override
- public TopDocs topDocs() {
- return subCollector.topDocs();
- }
-
@Override
public String toString() {
return "MultiLeafKnnCollector[subCollector=" + subCollector + "]";