TopKnnCollectorManager (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.search.knn, class: TopKnnCollectorManager

Package org.apache.lucene.search.knn

# Class TopKnnCollectorManager

java.lang.Object
org.apache.lucene.search.knn.TopKnnCollectorManager

All Implemented Interfaces:
  `KnnCollectorManager`

public class TopKnnCollectorManager extends Object implements KnnCollectorManager
TopKnnCollectorManager responsible for creating `TopKnnCollector` instances.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TopKnnCollectorManager(int k, IndexSearcher indexSearcher)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isOptimistic()`
  `KnnCollector`
  `newCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context)`
  Return a new `TopKnnCollector` instance.
  `KnnCollector`
  `newOptimisticCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context, int k)`
  Return a new `KnnCollector` instance, generally with a specific k value, scaled per leaf statistics

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TopKnnCollectorManager

    public TopKnnCollectorManager(int k, IndexSearcher indexSearcher)

- ## Method Details

  - ### newCollector

    public KnnCollector newCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context) throws IOException
    Return a new `TopKnnCollector` instance.
    Specified by:
      `newCollector` in interface `KnnCollectorManager`
    Parameters:
      `visitedLimit` - the maximum number of nodes that the search is allowed to visit
      `searchStrategy` - the optional search strategy configuration
      `context` - the leaf reader context
    Throws:
      `IOException`

  - ### newOptimisticCollector

    public KnnCollector newOptimisticCollector(int visitedLimit, KnnSearchStrategy searchStrategy, LeafReaderContext context, int k)
    Description copied from interface: `KnnCollectorManager`
    Return a new `KnnCollector` instance, generally with a specific k value, scaled per leaf statistics
    Specified by:
      `newOptimisticCollector` in interface `KnnCollectorManager`
    Parameters:
      `visitedLimit` - the maximum number of nodes that the search is allowed to visit
      `searchStrategy` - the optional search strategy configuration
      `context` - the leaf reader context
      `k` - the number of neighbors to collect, this is the expected number of results
    Returns:
      a new KnnCollector instance

  - ### isOptimistic

    public boolean isOptimistic()
    Specified by:
      `isOptimistic` in interface `KnnCollectorManager`