← ClaudeAtlas

duckdb-searchlisted

Build and query DuckDB 2.0 search indexes. Covers BM25 full-text search, layered prefix and fuzzy search, HNSW vector search, freshness, metric matching, hybrid ranking, nDCG, recall, MRR, and proof. Use when the user asks for keyword search, BM25, semantic search, HNSW, a nearest-neighbor index, rank evaluation, or ranked search over a table.
srimon12/duckdb-2-skills · ★ 1 · AI & Automation · score 65
Install: claude install-skill srimon12/duckdb-2-skills
# Search indexes Before writing SQL, choose among four search paths. Full-text ranks by keywords, layered full-text adds prefix and typo matching, HNSW ranks by vector distance, and hybrid fusion combines keywords and vectors. For spatial or as-of proximity, use `NEAREST` joins in `duckdb-sql` instead of an index. To install or load `fts` or `vss` offline, follow `duckdb-extensions`. ## Pick the path | Question | Path | First command | | --- | --- | --- | | Which rows contain these words, ranked by relevance? | BM25 | `PRAGMA create_fts_index(...)` | | Which rows contain this prefix, typo, or phrase? | Layered BM25 | `layered_search = 1` | | Which vectors are closest to this embedding? | HNSW | `CREATE INDEX ... USING HNSW` | | Combine keywords and embeddings | Two indexes | Fuse the ranks in SQL | For one-off queries, small tables, or narrow pre-filters, a sequential scan is usually faster than an index. ## Contract For FTS: ```text Inputs: one base table, one NOT NULL unique id, one or more text columns Outputs: ranked ids and scores Invariant: static index is a snapshot; incremental covers INSERT and DELETE, not UPDATE Proof: inserted term is found, deleted term is gone, updated term is repaired ``` For HNSW: ```text Inputs: one table, one FLOAT[N] column, non-null finite vectors Outputs: top-k ids by one distance function Invariant: index metric matches query function; query vector is a literal FLOAT[N] Proof: EXPLAIN shows HNSW_