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
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
FieldsFields inherited from class org.apache.lucene.search.knn.KnnSearchStrategy
DEFAULT_FILTERED_SEARCH_THRESHOLD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Override and implement search strategy instance equivalence properly in a subclass.int
int
hashCode()
Override and implement search strategy hash code properly in a subclass.void
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
-
Field Details
-
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
Description copied from class:KnnSearchStrategy
Override and implement search strategy instance equivalence properly in a subclass.- Specified by:
equals
in classKnnSearchStrategy
-
hashCode
public int hashCode()Description copied from class:KnnSearchStrategy
Override and implement search strategy hash code properly in a subclass.- Specified by:
hashCode
in classKnnSearchStrategy
- See Also:
-
nextVectorsBlock
public void nextVectorsBlock()Description copied from class:KnnSearchStrategy
Signal processing of the next block of vectors.- Specified by:
nextVectorsBlock
in classKnnSearchStrategy
-