Package-level declarations
Types
AbstractHnswGraphSearcher is the base class for HnswGraphSearcher implementations.
A blocking bounded min heap that stores floats. The top element is the lowest value of the heap.
A supplier that creates UpdateableRandomVectorScorer from an ordinal. Caller should be sure to close after use
This merger merges graph in a concurrent manner, by using HnswConcurrentMergeBuilder
Searches an HNSW graph to find nearest neighbors to a query vector. This particular implementation is optimized for a filtered search, inspired by the ACORN-1 algorithm. https://arxiv.org/abs/2403.04871 However, this implementation is augmented in some ways, mainly:
Interface for builder building the OnHeapHnswGraph
A graph builder that manages multiple workers, it only supports adding the whole graph all at once. It will spawn a thread for each worker and the workers will pick the work in batches.
Hierarchical Navigable Small World graph. Provides efficient approximate nearest neighbor search for high dimensional vectors. See Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs 2018 paper for details.
Builder for HNSW graph. See HnswGraph for a gloss on the algorithm and the meaning of the hyper-parameters.
Abstraction of merging multiple graphs into one on-heap graph
Searches an HNSW graph to find nearest neighbors to a query vector. For more background on the search algorithm, see HnswGraph.
Provide (read-and-write) striped locks for access to nodes of an OnHeapHnswGraph. For use by HnswConcurrentMergeBuilder and its HnswGraphBuilders.
This selects the biggest Hnsw graph from the provided merge state and initializes a new HnswGraphBuilder with that graph as a starting point.
This creates a graph builder that is initialized with the provided HnswGraph. This is useful for merging HnswGraphs from multiple segments.
Native int to int function
NeighborArray encodes the neighbors of a node and their mutual scores in the HNSW graph as a pair of growable arrays. Nodes are arranged in the sorted order of their scores in descending order (if scoresDescOrder is true), or in the ascending order of their scores (if scoresDescOrder is false)
NeighborQueue uses a LongHeap to store lists of arcs in an HNSW graph, represented as a neighbor node id with an associated score packed together as a sortable long, which is sorted primarily by score. The queue provides both fixed-size and unbounded operations via .insertWithOverflow and .add, and provides MIN and MAX heap subclasses.
An HnswGraph where all nodes and connections are held in memory. This class is used to construct the HNSW graph before it's written to the index.
Wraps a provided KnnCollector object, translating the provided vectorId ordinal to a documentId
A RandomVectorScorer for scoring random nodes in batches against an abstract query. This class isn't thread-safe and should be used by a single thread.
A supplier that creates RandomVectorScorer from an ordinal.
port of java.util.concurrent.locks.ReentrantReadWriteLock
Just like a RandomVectorScorer but allows the scoring ordinal to be changed. Useful during indexing operations