Single Query
Retrieves the nearest neighbors for a given query vector.Parameters
Returns
List[Dict[str, Union[int, float, Dict[]]]]: List of results for the query vector. Each dictionary contains id and optionally distance if return_distances is True.
Exceptions
ValueError
ValueError
- Throws if the query vector has incompatible dimensions with the index.
- Throws if the index was not created or loaded yet.
RuntimeError
RuntimeError
- Throws if the query could not be executed.
Example Usage
Single Query with Distances:Batched Queries
Retrieves the nearest neighbors for one or more query vectors.Parameters
Returns
List[List[Dict[str, Union[int, float, Dict[]]]]]: List of results for each query vector. Each result is a list of top_k dictionaries, each containing id and optionally distance if return_distances is True.
Exceptions
ValueError
ValueError
- Throws if the query vectors have incompatible dimensions with the index.
- Throws if the index was not created or loaded yet.
RuntimeError
RuntimeError
- Throws if the query could not be executed.