SPB Git

Repository Public BSD-3-Clause

0006-search-index.md 1.1 KB

# ADR 0006 — Search index: SQLite FTS5 with a grid instead of an R-tree

Date: 2026-11-25 · Status: accepted

Context. Offline search needs full-text and spatial lookups in one file per region, small enough to download (§9).

Decision. One SQLite file: contentless FTS5 for names, categories and coarse location tokens; places and points of interest in 0.005° grid cells stored as blobs; street geometry per cell; house numbers and interpolation ranges per street; a vocabulary table for typo correction. The directive allows "R-tree or equivalent": the R-tree module cost 14.4 MiB for the province against 3.5 MiB for the grid, with no measurable latency benefit at this size.

Measured (province of Québec, Mac M5 Max, warm cache). Index 86.4 MiB for 8 541 places, 275 157 points of interest, 134 053 streets, 1 488 538 addresses; full search p95 3.5 ms, suggestions p95 14.9 ms, reverse geocoding p95 0.5 ms.

Consequences. Only FTS5 is required from the system SQLite. House numbers absent from the data are never synthesized: the street is returned, flagged "number not found"; addr:interpolation positions are flagged as approximate.

Files main
Menu

Theme