Method BuildHybridRrfSql
- Namespace
- Qavren.Edge.VectorData
- Assembly
- Qavren.Edge.VectorData.dll
BuildHybridRrfSql(bool, bool)
The hybrid query: a vec0 KNN lane and an FTS5 bm25 lane, fused by reciprocal rank.
Both lanes rank ascending. FTS5's bm25() is the standard score multiplied by
-1, so a better match is numerically lower, and vec0's distance is a distance. The
hidden rank column is used rather than calling bm25(f), which SQLite's own
docs say is faster.
The keyword lane says f."<fts table>" MATCH $keywords - the alias
qualifying the table-named hidden column - and not the bare alias
f MATCH $keywords. FTS5 gives every table a hidden column named after the table, and
<x> MATCH <expr> is an ordinary comparison against a column, so a bare
alias resolves as a column reference and SQLite answers no such column: f. Measured
against SQLite 3.53.4 + FTS5 on 2026-09-11; spec 13.3's claim that the bare alias is the
only spelling that parses is wrong in both directions, and the spec is the side that is
being corrected.
The fused score is a similarity - higher is better - the opposite polarity to
BuildKnnSql(bool, bool, bool)'s distance.
public string BuildHybridRrfSql(bool hasFilter, bool includeVectors)
Parameters
hasFilterboolEmit the rowid pre-filter in BOTH lanes.
includeVectorsboolEmit both halves of the vector bracket: the LEFT JOIN and the projection.
Returns
- string
The query.