Table of Contents

Method QueryAsync

Namespace
Qavren.Edge.Sqlite.Vec
Assembly
Qavren.Edge.Sqlite.dll

QueryAsync(SqliteConnection, string, ReadOnlyMemory<float>, int, string?, IEnumerable<SqliteParameter>?, string, CancellationToken)

Runs a KNN query against a vec0 table and returns the matched row ids and distances.

public static Task<IReadOnlyList<KnnHit>> QueryAsync(SqliteConnection connection, string table, ReadOnlyMemory<float> query, int k, string? where = null, IEnumerable<SqliteParameter>? parameters = null, string vectorColumn = "embedding", CancellationToken cancellationToken = default)

Parameters

connection SqliteConnection

The open connection to query on.

table string

The vec0 table to query.

query ReadOnlyMemory<float>

The query vector.

k int

The number of nearest neighbours to return.

where string

An additional AND-joined predicate (metadata or partition-key filters), or null for none.

parameters IEnumerable<SqliteParameter>

Parameters bound by where, or null for none.

vectorColumn string

The vector column's name.

cancellationToken CancellationToken

Cancels the command.

Returns

Task<IReadOnlyList<KnnHit>>

The matched rows, ordered nearest first.

Exceptions

ArgumentNullException

connection is null.

ArgumentOutOfRangeException

k is less than 1.