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:KnnCollectorCollect the provided docId and include in the result set.- Specified by:
collectin interfaceKnnCollector- Overrides:
collectin classKnnCollector.Decorator- Parameters:
vectorId- of the vector to collectsimilarity- its calculated similarity- Returns:
- true if the vector is collected
-
topDocs
Description copied from interface:KnnCollectorThis drains the collected nearest kNN results and returns them in a newTopDocscollection, ordered by score descending. NOTE: This is generally a destructive action and the collector should not be used after topDocs() is called.- Specified by:
topDocsin interfaceKnnCollector- Overrides:
topDocsin classKnnCollector.Decorator- Returns:
- The collected top documents
-