Method SearchSimilarVectorsAsync
SearchSimilarVectorsAsync(string, float[], uint, VectorRetrievalOptions, MetadataCollection, CancellationToken)
Asynchronously searches for vectors within the specified collection that are similar to a given query vector.
Task<List<(PointEntry Point, float Score)>> SearchSimilarVectorsAsync(string collectionIdentifier, float[] vector, uint limit, VectorRetrievalOptions options, MetadataCollection metadataFilter, CancellationToken cancellationToken = default)
Parameters
collectionIdentifierstringThe name of the collection to search within.
vectorfloat[]The query vector used to compute similarity against stored vectors. The length of this vector should match the collection's defined vector size.
limituintThe maximum number of similar vector entries to return.
optionsVectorRetrievalOptionsA combination of VectorRetrievalOptions flags indicating which parts of each matching entry (vector data, metadata, or both) are included in the results.
metadataFilterMetadataCollectionAn optional collection of metadata key-value pairs to narrow the search scope. When specified, only vectors whose metadata matches all provided pairs are considered for similarity comparison.
cancellationTokenCancellationTokenAn optional token to cancel the asynchronous search operation.
Returns
- Task<List<(PointEntry Point, float Score)>>
A task representing the asynchronous search operation. The task result is a list of tuples, where each tuple contains a PointEntry and a
floatsimilarity score. The similarity score is computed using the underlying vector similarity algorithm defined by the implementation.
SearchSimilarVectorsAsync(string, float[], uint, VectorRetrievalOptions, MetadataFilter, CancellationToken)
Asynchronously searches for vectors within the specified collection that are similar to a given query vector, restricted to entries whose metadata satisfies the given filter expression.
Task<List<(PointEntry Point, float Score)>> SearchSimilarVectorsAsync(string collectionIdentifier, float[] vector, uint limit, VectorRetrievalOptions options, MetadataFilter filter, CancellationToken cancellationToken = default)
Parameters
collectionIdentifierstringThe name of the collection to search within.
vectorfloat[]The query vector used to compute similarity against stored vectors. The length of this vector should match the collection's defined vector size.
limituintThe maximum number of similar vector entries to return.
optionsVectorRetrievalOptionsA combination of VectorRetrievalOptions flags indicating which parts of each matching entry (vector data, metadata, or both) are included in the results.
filterMetadataFilterAn optional filter expression to narrow the search scope. When specified, only vectors whose metadata satisfies the expression are considered for similarity comparison. Supports typed comparisons (eq, ne, gt, gte, lt, lte, in, nin, exists) combined with and/or; see MetadataFilter for the exact matching semantics. Pass
nullfor no filtering.cancellationTokenCancellationTokenAn optional token to cancel the asynchronous search operation.
Returns
- Task<List<(PointEntry Point, float Score)>>
A task representing the asynchronous search operation. The task result is a list of tuples, where each tuple contains a PointEntry and a
floatsimilarity score.