Table of Contents

Method SearchAsync

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

SearchAsync<TInput>(TInput, int, VectorSearchOptions<TRecord>?, CancellationToken)

A vec0 KNN search. searchValue may be a string (embedded through the query generator), ReadOnlyMemory<T> of float, float[] or Embedding<T> of float.

Score is the vec0 distance: lower is better - the opposite polarity to HybridSearchAsync<TInput>(TInput, ICollection<string>, int, HybridSearchOptions<TRecord>?, CancellationToken)'s fused score. ScoreThreshold is pushed down as v.distance <= $t.

Skip is honoured client-side, by discarding the first N rows while reading over k = top + Skip. SQLITE_INDEX_CONSTRAINT_OFFSET is skipped in every loop of vec0BestIndex and never given an argvIndex, so an OFFSET in the KNN query would be ignored rather than applied. It is never silently dropped.

public override IAsyncEnumerable<VectorSearchResult<TRecord>> SearchAsync<TInput>(TInput searchValue, int top, VectorSearchOptions<TRecord>? options = null, CancellationToken cancellationToken = default) where TInput : notnull

Parameters

searchValue TInput

The query vector, or the text to embed into one.

top int

How many results to return.

options VectorSearchOptions<TRecord>

Filter, threshold, skip and vector-inclusion options.

cancellationToken CancellationToken

Cancels the work.

Returns

IAsyncEnumerable<VectorSearchResult<TRecord>>

The results, nearest first.

Type Parameters

TInput

The search input type.