Feature Spec: Full-Text Hybrid Search with SQLite FTS5

By Jay Griffin, Claude Sonnet 4.6*Summarized from a Claude.ai conversation·  March 2, 2026
docsProject: jaygriff
🏷️ Tags:searchsqlitefts5specarchitecture

Replacing Fuse.js title-only search with server-side full-text search using SQLite FTS5 — paragraph-level results with highlighted snippet previews linking directly to headings.

Overview

Replace the current Fuse.js title-only search with a server-side full-text search powered by SQLite FTS5. Search results will return at the paragraph/section level with highlighted snippet previews, linking directly to the relevant heading within an article.


Why


Approach

1. Content Chunking (build time)

2. SQLite FTS5 Table

.sql
CREATE VIRTUAL TABLE search_fts USING fts5(
  heading_text,
  body_text,
  content='chunks',
  content_rowid='id'
);

3. Search API Route

.sql
SELECT
  slug,
  heading_id,
  heading_text,
  snippet(search_fts, 1, '<mark>', '</mark>', '...', 20) as excerpt
FROM search_fts
JOIN chunks ON chunks.id = search_fts.rowid
WHERE search_fts MATCH ?
ORDER BY rank

4. Search UI


Prerequisites

Implementation Steps


Notes

Related Posts

  • Why I'm Finally Moving to SQLite (And Why I Waited Until Now)
    After over 60 articles in one month, my file-based content system is breaking down. Here's why I'm migrating to SQLite, why now, and why I didn't do this sooner.
  • Content Layer: Current System Documentation
    Reference doc for the SQLite migration. Captures exactly how the current filesystem-based content system works, where the pain points are, and what each function actually does.
  • LLM SEO Implementation Roadmap
    A practical guide to optimizing your site for AI-powered search and LLM discoverability - actionable strategies for appearing in ChatGPT, Claude, Perplexity, and other LLM-generated responses