You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Docs: rewrite search-by-meaning around a vec0 index instead of per-row embed() #1003
docs/howto/search-by-meaning.md teaches semantic search as a path-table
subquery that embeds every matched file at query time:
SELECTpath,
vec_distance_cosine(emb, embed('how do I cook pasta?')) AS distance
FROM (SELECTpath, embed(content) AS emb FROM'./notes/*.md')
WHERE emb IS NOT NULLORDER BY distance
LIMIT3
That is the only shape the guide teaches, and it costs one worker round trip
per matched file, per query, on top of a path-table walk that re-reads every
file's content. The vector cache
removes the model inference on a repeat run — it does not remove the round
trip and it does not remove the walk.
Since #956 the alternative is expressible in config: a vec0 virtual table
declared in the same ddl batch as the row table, filled by a trigger calling embed(). A query then embeds once (the query text) and vec0 does an
in-process KNN scan — the query-side effect #956 called out.
#994 added a ::: tip pointing at docs/reference/config.md#batch-ddl, but
left the guide's central example, and its whole narrative, on the per-row
shape.
Change
Rewrite the guide so the declared-table + vec0 shape is the primary path:
Query with WHERE embedding MATCH embed(:q, '') AND k = :n, joined back to
the base table on rowid, ordered by distance.
Keep the path-table ORDER BY vec_distance_cosine(...) LIMIT k shape as the zero-setup option and state the trade explicitly — it is the same
declared-table-vs-path-table trade Docs: path-table vs declared-table tradeoff; FTS5 and vector index templates #960 documents: no config, always
current, pays per query; versus config plus --persist, watcher-maintained,
one embed per query.
Retire or rewrite the ::: tip Top-k is LIMIT k block. It exists to explain
why MATCH … AND k = does not apply, which stops being true once the
primary example uses vec0.
Activity
docs: split search-by-meaning from the index recipe, fix the vec0 tem…