Expand description
VectorBackend backed by [sqlite-vec] exact KNN.
sqlite-vec ships only the C function sqlite3_vec_init; there is no Rust
wrapper. We static-register it as a SQLite auto extension via
sqlite3_auto_extension (one Once per process) so the vec0 virtual
table is available on every connection without load_extension. This was
verified in the P0 spike — notably the rusqlite bundled feature alone
suffices (no load_extension feature is needed) because the extension is
linked into the same SQLITE_CORE build.
Scale ceiling: vec0 does exact brute-force KNN (not HNSW), so it is
the right pick for mobile / small persistent stores (~10⁵ vectors). For
desktop/server scale use UsearchBackend.
Metadata filtering is post-filter: vec0 KNN runs first over the full
set, then non-matching rows are dropped. To stay correct under selective
filters we over-fetch (limit = top_k * OVER_FETCH_FACTOR, capped) and
post-filter down to top_k. This is a documented trade-off of the exact-
KNN engine; for highly selective filters on large sets prefer UsearchBackend
which supports true pre-filter via a search callback.
Structs§
- Sqlite
VecBackend - Exact-KNN vector backend over a
vec0virtual table.