Table of Contents

Method UpsertAsync

Namespace
Qavren.Edge.VectorData
Assembly
Qavren.Edge.VectorData.dll

UpsertAsync(TRecord, CancellationToken)

Upserts a record into the vector store. Does not guarantee that the collection exists. If the record already exists, it is updated. If the record does not exist, it is created.

public override Task UpsertAsync(TRecord record, CancellationToken cancellationToken = default)

Parameters

record TRecord

The record to upsert.

cancellationToken CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

Task

A Task that completes when the record has been upserted.

Exceptions

VectorStoreException

The command fails to execute for any reason.

UpsertAsync(IEnumerable<TRecord>, CancellationToken)

Overridden rather than inherited, because MEVD leaves the batch overload abstract with no default: every embedding in the batch is generated in one GenerateAsync call before the transaction opens, and the whole batch then commits together.

The vec0 side is delete-then-insert, never UPDATE, for two reasons both true of sqlite-vec 0.1.9: a working INSERT OR REPLACE only arrives in 0.1.10-alpha, and vec0 overloads SQL NULL on a vector column to mean "no change". FTS5 is trigger-maintained off the data table and never appears in the write path.

public override Task UpsertAsync(IEnumerable<TRecord> records, CancellationToken cancellationToken = default)

Parameters

records IEnumerable<TRecord>

The records to write.

cancellationToken CancellationToken

Cancels the work.

Returns

Task

A task that completes when the transaction has committed.