Package org.apache.lucene.util.hnsw
Class HnswGraphSearcher
- java.lang.Object
-
- org.apache.lucene.util.hnsw.HnswGraphSearcher
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NeighborQueue
search(float[] query, int topK, RandomAccessVectorValues vectors, VectorSimilarityFunction similarityFunction, HnswGraph graph, Bits acceptOrds, int visitedLimit)
Searches HNSW graph for the nearest neighbors of a query vector.
-
-
-
Method Detail
-
search
public static NeighborQueue search(float[] query, int topK, RandomAccessVectorValues vectors, VectorSimilarityFunction similarityFunction, HnswGraph graph, Bits acceptOrds, int visitedLimit) throws IOException
Searches HNSW graph for the nearest neighbors of a query vector.- Parameters:
query
- search query vectortopK
- the number of nodes to be returnedvectors
- the vector valuessimilarityFunction
- the similarity function to compare vectorsgraph
- the graph values. May represent the entire graph, or a level in a hierarchical graph.acceptOrds
-Bits
that represents the allowed document ordinals to match, ornull
if they are all allowed to match.visitedLimit
- the maximum number of nodes that the search is allowed to visit- Returns:
- a priority queue holding the closest neighbors found
- Throws:
IOException
-
-