Encrypted Index
Query
Single Query
Retrieves the nearest neighbors for a given query vector.
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
query_vector | List[float] | - | A single query vector as a list of floats (for single query). |
top_k | int | 100 | (Optional) Number of nearest neighbors to return. |
n_probes | int | 1 | (Optional) Number of lists probed during the query; higher values may increase recall but can also reduce performance. |
greedy | bool | False | (Optional) Whether to use greedy search (higher recall with same n_probes ). |
return_distances | bool | True | (Optional) If True , each result includes distance . |
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
Example Usage
Single Query with Distances:
Single Query without Distances:
Batched Queries
Retrieves the nearest neighbors for one or more query vectors.
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
query_vectors | np.ndarray or List[List[float]] | - | A 2D NumPy array or list of lists, where each inner list represents a query vector (for batch query). |
top_k | int | 100 | (Optional) Number of nearest neighbors to return. |
n_probes | int | 1 | (Optional) Number of lists probed during the query; higher values may increase recall but can also reduce performance. |
greedy | bool | False | (Optional) Whether to use greedy search (higher recall with same n_probes ). |
return_distances | bool | True | (Optional) If True , each result includes (ID, distance) . If False , only IDs are returned. |
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
Example Usage
Batch Query with Distances:
Was this page helpful?