Class OrdinalTranslatedKnnCollector

java.lang.Object
org.apache.lucene.search.KnnCollector.Decorator
org.apache.lucene.util.hnsw.OrdinalTranslatedKnnCollector
All Implemented Interfaces:
KnnCollector

public final class OrdinalTranslatedKnnCollector extends KnnCollector.Decorator
Wraps a provided KnnCollector object, translating the provided vectorId ordinal to a documentId
  • Constructor Details

  • 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 interface KnnCollector
      Overrides:
      collect in class KnnCollector.Decorator
      Parameters:
      vectorId - of the vector to collect
      similarity - its calculated similarity
      Returns:
      true if the vector is collected
    • topDocs

      public TopDocs topDocs()
      Description copied from interface: KnnCollector
      This drains the collected nearest kNN results and returns them in a new TopDocs 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 interface KnnCollector
      Overrides:
      topDocs in class KnnCollector.Decorator
      Returns:
      The collected top documents