search

fun search(scorer: RandomVectorScorer, knnCollector: KnnCollector, graph: HnswGraph, acceptOrds: Bits)

See HnswGraphSearcher.search

Parameters

scorer

the scorer to compare the query with the nodes

knnCollector

a hnsw knn collector of top knn results to be returned

graph

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, or null if they are all allowed to match.


fun search(scorer: RandomVectorScorer, knnCollector: KnnCollector, graph: HnswGraph, acceptOrds: Bits?, filteredDocCount: Int)

Searches the HNSW graph for the nearest neighbors of a query vector. If entry points are directly provided via the knnCollector, then the search will be initialized at those points. Otherwise, the search will discover the best entry point per the normal HNSW search algorithm.

Parameters

scorer

the scorer to compare the query with the nodes

knnCollector

a hnsw knn collector of top knn results to be returned

graph

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, or null if they are all allowed to match.

filteredDocCount

the number of docs that pass the filter


fun search(scorer: RandomVectorScorer, topK: Int, graph: OnHeapHnswGraph, acceptOrds: Bits, visitedLimit: Int): KnnCollector

Search OnHeapHnswGraph, this method is thread safe.

Return

a set of collected vectors holding the nearest neighbors found

Parameters

scorer

the scorer to compare the query with the nodes

topK

the number of nodes to be returned

graph

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, or null if they are all allowed to match.

visitedLimit

the maximum number of nodes that the search is allowed to visit