Package org.apache.lucene.search.knn
Class MultiLeafKnnCollector
java.lang.Object
org.apache.lucene.search.KnnCollector.Decorator
org.apache.lucene.search.knn.MultiLeafKnnCollector
- All Implemented Interfaces:
KnnCollector
MultiLeafKnnCollector is a specific KnnCollector that can exchange the top collected results
across segments through a shared global queue.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.lucene.search.KnnCollector
KnnCollector.Decorator
-
Field Summary
Fields inherited from class org.apache.lucene.search.KnnCollector.Decorator
collector
-
Constructor Summary
ConstructorsConstructorDescriptionMultiLeafKnnCollector
(int k, float greediness, int interval, BlockingFloatHeap globalSimilarityQueue, AbstractKnnCollector subCollector) Create a new MultiLeafKnnCollector.MultiLeafKnnCollector
(int k, BlockingFloatHeap globalSimilarityQueue, AbstractKnnCollector subCollector) Create a new MultiLeafKnnCollector. -
Method Summary
Methods inherited from class org.apache.lucene.search.KnnCollector.Decorator
earlyTerminated, getSearchStrategy, incVisitedCount, k, topDocs, visitedCount, visitLimit
-
Constructor Details
-
MultiLeafKnnCollector
public MultiLeafKnnCollector(int k, BlockingFloatHeap globalSimilarityQueue, AbstractKnnCollector subCollector) Create a new MultiLeafKnnCollector.- Parameters:
k
- the number of neighbors to collectglobalSimilarityQueue
- the global queue of the highest similarities collected so far across all segmentssubCollector
- the local collector
-
MultiLeafKnnCollector
public MultiLeafKnnCollector(int k, float greediness, int interval, BlockingFloatHeap globalSimilarityQueue, AbstractKnnCollector subCollector) Create a new MultiLeafKnnCollector.- Parameters:
k
- the number of neighbors to collectgreediness
- the greediness of the global searchinterval
- (by number of collected values) the interval to synchronize the local and global queuesglobalSimilarityQueue
- the global queue of the highest similarities collected so farsubCollector
- the local collector
-
-
Method Details
-
collect
public boolean collect(int docId, float similarity) Description copied from interface:KnnCollector
Collect the provided docId and include in the result set.- Specified by:
collect
in interfaceKnnCollector
- Overrides:
collect
in classKnnCollector.Decorator
- Parameters:
docId
- of the vector to collectsimilarity
- its calculated similarity- Returns:
- true if the vector is collected
-
minCompetitiveSimilarity
public float minCompetitiveSimilarity()Description copied from interface:KnnCollector
This method is utilized during search to ensure only competitive results are explored.Consequently, if this results collector wants to collect `k` results, this should return
Float.NEGATIVE_INFINITY
when not full.When full, the minimum score should be returned.
- Specified by:
minCompetitiveSimilarity
in interfaceKnnCollector
- Overrides:
minCompetitiveSimilarity
in classKnnCollector.Decorator
- Returns:
- the current minimum competitive similarity in the collection
-
toString
-