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

Package org.apache.lucene.search.knn

# Class KnnSearchStrategy.Hnsw

java.lang.Object
org.apache.lucene.search.knn.KnnSearchStrategy
org.apache.lucene.search.knn.KnnSearchStrategy.Hnsw

Direct Known Subclasses:
  `KnnSearchStrategy.Patience`

Enclosing class:
  `KnnSearchStrategy`

public static class KnnSearchStrategy.Hnsw extends KnnSearchStrategy
A strategy for kNN search that uses HNSW

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.search.knn.KnnSearchStrategy

  `KnnSearchStrategy.Hnsw, KnnSearchStrategy.Patience, KnnSearchStrategy.Seeded`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final KnnSearchStrategy.Hnsw`
  `DEFAULT`

  ### Fields inherited from class org.apache.lucene.search.knn.KnnSearchStrategy

  `DEFAULT_FILTERED_SEARCH_THRESHOLD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Hnsw(int filteredSearchThreshold)`
  Create a new Hnsw strategy

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  Override and implement search strategy instance equivalence properly in a subclass.
  `int`
  `filteredSearchThreshold()`
  `int`
  `hashCode()`
  Override and implement search strategy hash code properly in a subclass.
  `void`
  `nextVectorsBlock()`
  Signal processing of the next block of vectors.
  `final boolean`
  `useFilteredSearch(float ratioPassingFilter)`
  Whether to use filtered search based on the ratio of vectors that pass the filter

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

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

- ## Field Details

  - ### DEFAULT

    public static final KnnSearchStrategy.Hnsw DEFAULT

- ## Constructor Details

  - ### Hnsw

    public Hnsw(int filteredSearchThreshold)
    Create a new Hnsw strategy
    Parameters:
      `filteredSearchThreshold` - threshold for filtered search, a percentage value from 0 to 100 where 0 means never use filtered search and 100 means always use filtered search.

- ## Method Details

  - ### filteredSearchThreshold

    public int filteredSearchThreshold()

  - ### useFilteredSearch

    public final boolean useFilteredSearch(float ratioPassingFilter)
    Whether to use filtered search based on the ratio of vectors that pass the filter
    Parameters:
      `ratioPassingFilter` - ratio of vectors that pass the filter
    Returns:
      true if filtered search should be used

  - ### equals

    public boolean equals(Object o)
    Description copied from class: `KnnSearchStrategy`
    Override and implement search strategy instance equivalence properly in a subclass.
    Specified by:
      `equals` in class `KnnSearchStrategy`

  - ### hashCode

    public int hashCode()
    Description copied from class: `KnnSearchStrategy`
    Override and implement search strategy hash code properly in a subclass.
    Specified by:
      `hashCode` in class `KnnSearchStrategy`
    See Also:
      - `KnnSearchStrategy.equals(Object)`

  - ### nextVectorsBlock

    public void nextVectorsBlock()
    Description copied from class: `KnnSearchStrategy`
    Signal processing of the next block of vectors.
    Specified by:
      `nextVectorsBlock` in class `KnnSearchStrategy`