Package org.apache.lucene.util.hnsw
Class OrdinalTranslatedKnnCollector
java.lang.Object
org.apache.lucene.search.KnnCollector.Decorator
org.apache.lucene.util.hnsw.OrdinalTranslatedKnnCollector
- All Implemented Interfaces:
KnnCollector
Wraps a provided KnnCollector object, translating the provided vectorId ordinal to a documentId
-
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
ConstructorsConstructorDescriptionOrdinalTranslatedKnnCollector
(KnnCollector collector, IntToIntFunction vectorOrdinalToDocId) -
Method Summary
Methods inherited from class org.apache.lucene.search.KnnCollector.Decorator
earlyTerminated, getSearchStrategy, incVisitedCount, k, minCompetitiveSimilarity, visitedCount, visitLimit
-
Constructor Details
-
OrdinalTranslatedKnnCollector
-
-
Method Details
-
collect
public boolean collect(int vectorId, 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:
vectorId
- of the vector to collectsimilarity
- its calculated similarity- Returns:
- true if the vector is collected
-
topDocs
Description copied from interface:KnnCollector
This drains the collected nearest kNN results and returns them in a newTopDocs
collection, ordered by score descending. NOTE: This is generally a destructive action and the collector should not be used after topDocs() is called.- Specified by:
topDocs
in interfaceKnnCollector
- Overrides:
topDocs
in classKnnCollector.Decorator
- Returns:
- The collected top documents
-