Method GetAsync
- Namespace
- Qavren.Edge.VectorData
- Assembly
- Qavren.Edge.VectorData.dll
GetAsync(TKey, RecordRetrievalOptions?, CancellationToken)
Gets a record from the vector store. Does not guarantee that the collection exists. Returns null if the record is not found.
public override Task<TRecord?> GetAsync(TKey key, RecordRetrievalOptions? options = null, CancellationToken cancellationToken = default)
Parameters
keyTKeyThe unique ID associated with the record to get.
optionsRecordRetrievalOptionsOptional options for retrieving the record.
cancellationTokenCancellationTokenThe CancellationToken to monitor for cancellation requests. The default is None.
Returns
- Task<TRecord>
The record if found, otherwise null.
Exceptions
- VectorStoreException
The command fails to execute for any reason.
GetAsync(IEnumerable<TKey>, RecordRetrievalOptions?, CancellationToken)
Gets a batch of records from the vector store. Does not guarantee that the collection exists.
public override IAsyncEnumerable<TRecord> GetAsync(IEnumerable<TKey> keys, RecordRetrievalOptions? options = null, CancellationToken cancellationToken = default)
Parameters
keysIEnumerable<TKey>The unique IDs associated with the record to get.
optionsRecordRetrievalOptionsOptional options for retrieving the records.
cancellationTokenCancellationTokenThe CancellationToken to monitor for cancellation requests. The default is None.
Returns
- IAsyncEnumerable<TRecord>
The records associated with the specified unique keys.
Remarks
The exact method of retrieval is implementation-specific and can vary based on database support. The default implementation of this method retrieves the records one after the other, but implementations which supporting batching can override to provide a more efficient implementation.
Only found records are returned, so the result set might be smaller than the requested keys.
This method throws for any issues other than records not being found.
Exceptions
- VectorStoreException
The command fails to execute for any reason.
GetAsync(Expression<Func<TRecord, bool>>, int, FilteredRecordRetrievalOptions<TRecord>?, CancellationToken)
Gets matching records from the vector store. Does not guarantee that the collection exists.
public override IAsyncEnumerable<TRecord> GetAsync(Expression<Func<TRecord, bool>> filter, int top, FilteredRecordRetrievalOptions<TRecord>? options = null, CancellationToken cancellationToken = default)
Parameters
filterExpression<Func<TRecord, bool>>The predicate to filter the records.
topintThe maximum number of results to return.
optionsFilteredRecordRetrievalOptions<TRecord>Options for retrieving the records.
cancellationTokenCancellationTokenThe CancellationToken to monitor for cancellation requests. The default is None.
Returns
- IAsyncEnumerable<TRecord>
The records that match the given predicate.
Exceptions
- VectorStoreException
The command fails to execute for any reason.