← All notes

Full-text search in SQLite with FTS5

Answer: FTS5 is SQLite's full-text search module. Create a virtual table with USING fts5(...), then search with MATCH, rank with bm25 and show matches with highlight or snippet.

CREATE VIRTUAL TABLE docs USING fts5(title, body);
INSERT INTO docs VALUES ('SQLite', 'FTS5 is a full-text search module');

SELECT title FROM docs WHERE docs MATCH 'fts5';
SELECT highlight(docs, 1, '<b>', '</b>') FROM docs WHERE docs MATCH 'search';
SELECT title FROM docs WHERE docs MATCH 'body:module' ORDER BY rank;

Facts

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: SQLite (sqlite.org), SQLite FTS5 Extension, Public domain (sqlite.org); SQLite (sqlite.org), SQLite FTS3 and FTS4 Extensions, Public domain (sqlite.org).

Cite this

Permanent ID: iil:note:50szqn5s

iinventedlight. 2026. "Full-text search in SQLite with FTS5." iinventedlight Library, iil:note:50szqn5s, version of 2026-11-04. https://iinventedlight.com/library/notes/sqlite-fts5/. License: CC-BY-4.0.

@misc{iil_note_50szqn5s,
  author = {{iinventedlight}},
  title = {{Full-text search in SQLite with FTS5}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/sqlite-fts5/},
  note = {Permanent ID iil:note:50szqn5s. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/sqlite-fts5.md.