# Uses of Interface
org.apache.lucene.search.KnnCollector

Packages that use KnnCollector
Package
Description
org.apache.lucene.codecs
Codecs API: API for customization of the encoding and structure of the index.
org.apache.lucene.codecs.hnsw
HNSW vector helper classes.
org.apache.lucene.codecs.lucene99
Lucene 9.9 file format.
org.apache.lucene.codecs.perfield
Postings format that can delegate to different formats per-field.
org.apache.lucene.index
Code to maintain and access indices.
org.apache.lucene.search
Code to search indices.
org.apache.lucene.search.knn
Classes related to vector search: knn and vector fields.
org.apache.lucene.util.hnsw
Navigable Small-World graph, nominally Hierarchical but currently only has a single layer.

- ## Uses of KnnCollector in org.apache.lucene.codecs

  Methods in org.apache.lucene.codecs with parameters of type KnnCollector
  Modifier and Type
  Method
  Description
  `abstract void`
  KnnVectorsReader.`search(String field, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  Return the k nearest neighbor documents as determined by comparison of their vector values for this field, to the given vector, by the field's similarity function.
  `abstract void`
  KnnVectorsReader.`search(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  Return the k nearest neighbor documents as determined by comparison of their vector values for this field, to the given vector, by the field's similarity function.

- ## Uses of KnnCollector in org.apache.lucene.codecs.hnsw

  Methods in org.apache.lucene.codecs.hnsw with parameters of type KnnCollector
  Modifier and Type
  Method
  Description
  `void`
  FlatVectorsReader.`search(String field, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `void`
  FlatVectorsReader.`search(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`

- ## Uses of KnnCollector in org.apache.lucene.codecs.lucene99

  Methods in org.apache.lucene.codecs.lucene99 with parameters of type KnnCollector
  Modifier and Type
  Method
  Description
  `void`
  Lucene99HnswVectorsReader.`search(String field, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `void`
  Lucene99HnswVectorsReader.`search(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`

- ## Uses of KnnCollector in org.apache.lucene.codecs.perfield

  Methods in org.apache.lucene.codecs.perfield with parameters of type KnnCollector
  Modifier and Type
  Method
  Description
  `void`
  PerFieldKnnVectorsFormat.FieldsReader.`search(String field, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `void`
  PerFieldKnnVectorsFormat.FieldsReader.`search(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`

- ## Uses of KnnCollector in org.apache.lucene.index

  Methods in org.apache.lucene.index with parameters of type KnnCollector
  Modifier and Type
  Method
  Description
  `final void`
  CodecReader.`searchNearestVectors(String field, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `final void`
  CodecReader.`searchNearestVectors(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `void`
  ExitableDirectoryReader.ExitableFilterAtomicReader.`searchNearestVectors(String field, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `void`
  ExitableDirectoryReader.ExitableFilterAtomicReader.`searchNearestVectors(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `void`
  FilterLeafReader.`searchNearestVectors(String field, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `void`
  FilterLeafReader.`searchNearestVectors(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `abstract void`
  LeafReader.`searchNearestVectors(String field, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  Return the k nearest neighbor documents as determined by comparison of their vector values for this field, to the given vector, by the field's similarity function.
  `abstract void`
  LeafReader.`searchNearestVectors(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  Return the k nearest neighbor documents as determined by comparison of their vector values for this field, to the given vector, by the field's similarity function.
  `void`
  ParallelLeafReader.`searchNearestVectors(String fieldName, byte[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`
  `void`
  ParallelLeafReader.`searchNearestVectors(String fieldName, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)`

- ## Uses of KnnCollector in org.apache.lucene.search

  Classes in org.apache.lucene.search that implement KnnCollector
  Modifier and Type
  Class
  Description
  `class`
  `AbstractKnnCollector`
  AbstractKnnCollector is the default implementation for a knn collector used for gathering kNN results and providing topDocs from the gathered neighbors
  `class`
  `HnswQueueSaturationCollector`
  A `KnnCollector.Decorator` that early exits when nearest neighbor queue keeps saturating beyond a 'patience' parameter.
  `static class`
  `KnnCollector.Decorator`
  KnnCollector.Decorator is the base class for decorators of KnnCollector objects, which extend the object with new behaviors.
  `class`
  `TopKnnCollector`
  TopKnnCollector is a specific KnnCollector.
  Fields in org.apache.lucene.search declared as KnnCollector
  Modifier and Type
  Field
  Description
  `protected final KnnCollector`
  KnnCollector.Decorator.`collector`
  Methods in org.apache.lucene.search that return KnnCollector
  Modifier and Type
  Method
  Description
  `KnnCollector`
  TimeLimitingKnnCollectorManager.`newCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context)`
  Constructors in org.apache.lucene.search with parameters of type KnnCollector
  Modifier
  Constructor
  Description
  ``
  `Decorator(KnnCollector collector)`
  ``
  `HnswQueueSaturationCollector(KnnCollector delegate, double saturationThreshold, int patience)`

- ## Uses of KnnCollector in org.apache.lucene.search.knn

  Classes in org.apache.lucene.search.knn that implement KnnCollector
  Modifier and Type
  Class
  Description
  `final class`
  `MultiLeafKnnCollector`
  MultiLeafKnnCollector is a specific KnnCollector that can exchange the top collected results across segments through a shared global queue.
  Methods in org.apache.lucene.search.knn that return KnnCollector
  Modifier and Type
  Method
  Description
  `KnnCollector`
  KnnCollectorManager.`newCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context)`
  Return a new `KnnCollector` instance.
  `KnnCollector`
  TopKnnCollectorManager.`newCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context)`
  Return a new `TopKnnCollector` instance.
  `default KnnCollector`
  KnnCollectorManager.`newOptimisticCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context, int k)`
  Return a new `KnnCollector` instance, generally with a specific k value, scaled per leaf statistics
  `KnnCollector`
  TopKnnCollectorManager.`newOptimisticCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context, int k)`

- ## Uses of KnnCollector in org.apache.lucene.util.hnsw

  Classes in org.apache.lucene.util.hnsw that implement KnnCollector
  Modifier and Type
  Class
  Description
  `static final class`
  `HnswGraphBuilder.GraphBuilderKnnCollector`
  A restricted, specialized knnCollector that can be used when building a graph.
  `final class`
  `OrdinalTranslatedKnnCollector`
  Wraps a provided KnnCollector object, translating the provided vectorId ordinal to a documentId
  Methods in org.apache.lucene.util.hnsw that return KnnCollector
  Modifier and Type
  Method
  Description
  `static KnnCollector`
  HnswGraphSearcher.`search(RandomVectorScorer scorer, int topK, OnHeapHnswGraph graph, Bits acceptOrds, int visitedLimit)`
  Search `OnHeapHnswGraph`, this method is thread safe.
  Methods in org.apache.lucene.util.hnsw with parameters of type KnnCollector
  Modifier and Type
  Method
  Description
  `static void`
  HnswGraphSearcher.`search(RandomVectorScorer scorer, KnnCollector knnCollector, HnswGraph graph, Bits acceptOrds)`
  See `HnswGraphSearcher.search(RandomVectorScorer, KnnCollector, HnswGraph, Bits, int)`
  `static void`
  HnswGraphSearcher.`search(RandomVectorScorer scorer, KnnCollector knnCollector, HnswGraph graph, Bits acceptOrds, int filteredDocCount)`
  Searches the HNSW graph for the nearest neighbors of a query vector.
  Constructors in org.apache.lucene.util.hnsw with parameters of type KnnCollector
  Modifier
  Constructor
  Description
  ``
  `OrdinalTranslatedKnnCollector(KnnCollector collector, IntToIntFunction vectorOrdinalToDocId)`