com.phronemophobic.usearch
add
(add index key vec)(add index key vec vector-kind)Adds a vector with a key to the index.
index: A usearch index.
key: An integer key
vec: A vector to add to the index.
init
(init opts vecs)(init opts)Creates a new index with opts.
If vecs are provided, they will be added to index.
vecs should be a sequence of key, vec pairs.
Required:
:dimensions Length of vectors that will be indexed
:metric The metric used to measure distance. One of
:metric/cos
:metric/divergence
:metric/hamming
:metric/haversine
:metric/ip
:metric/jaccard
:metric/l2sq
:metric/pearson
:metric/sorensen
:metric/tanimoto
:quantization The datatype for the vectors that will be indexed. One of
:quantization/f32
:quantization/f64
:quantization/i8
Optional:
:connectivity limits connections-per-node in graph
:expansions-add expansion factor used for index construction when adding vectors.
:expansions-search used for index construction during search operations.
load
(load index path)Loads the index from path. index must have already been initialized.
remove
(remove index key)Removes the vector associated with the given key from the index.
reserve
(reserve index capacity)Sets capacity to capacity.
Has no effect if capacity is lower than the index's current capacity.
search
(search index vec)(search index vec n)Performs k-Approximate Nearest Neighbors (kANN) Search for closest vectors to query.
Returns a map of the n closest matches. The keys are the keys and values are the distances.
If no n is provided, returns the closest match.
serialized-length
(serialized-length index)Reports expected file size after serialization.