Full-Text Search Queries

SELECT title, bm25_score(body, 'distributed database rust') AS score
FROM articles
WHERE text_match(body, 'distributed database rust')
ORDER BY score DESC LIMIT 20;
SELECT title FROM articles WHERE text_match(title, 'databse', { fuzzy: true, distance: 2 });

Synonyms

CREATE SYNONYM GROUP db_terms AS ('database', 'db', 'datastore');
-- Searching for 'db performance' now also matches 'database performance'

CJK text is automatically tokenized via character bigrams:

SELECT title FROM articles WHERE text_match(body, '全文検索');

Hybrid Search (BM25 + Vector)

SELECT title, rrf_score(
    vector_distance(embedding, $query_vec),
    bm25_score(body, 'distributed systems')
) AS score
FROM articles
LIMIT 10;