Search foundation: provider trait and FTS5 #10

Closed
opened 2026-10-13 15:01:15 +00:00 by kayg · 2 comments
Owner

Search foundation (ADR 0031).

  • SearchProvider trait, FTS5 (unicode61 + trigram) per user, providers per plugin, permission-filtered on the server.
  • Ranking (title, frecency, body), typo/prefix tolerance, snippets with block deep links.
  • Benchmark on the perf VM: first results < 50 ms on the full v0 data copy, as a gate. Palette UI gets its own mockup later.
Search foundation (ADR 0031). - SearchProvider trait, FTS5 (unicode61 + trigram) per user, providers per plugin, permission-filtered on the server. - Ranking (title, frecency, body), typo/prefix tolerance, snippets with block deep links. - Benchmark on the perf VM: first results < 50 ms on the full v0 data copy, as a gate. Palette UI gets its own mockup later.
Author
Owner

Progress: the search foundation is up for review in PR #53 (API only; the palette waits for its own mockup).

Interim speed, idle staging VM, 4 vCPU (the perf VM was busy with #14):

10k notes 100k notes
all queries p50 / p95 6.8 / 8.2 ms 20.3 / 31.7 ms
worst query p95 8.5 ms 38.6 ms
re-index one edit (database work) p50 0.6 ms 0.5 ms
first build (background) 3.3 s 41 s
index size 71 MB 681 MB

Budget: under 50 ms p95 at 10k. Met, and 100k stays under it too.

What changed while measuring:

  • Ranking cost. Full ranking of every match (BM25) is now used only when matches are few. With many matches, cost stays flat by gathering title matches, the newest matches (row ids follow when things changed) and frecent ones.
  • Snippets are now cut in Rust. They were 12 ms of every search.
  • The write-ahead log grew without limit during a first build: 4 GB at 100k. The writer now checkpoints it in quiet moments and caps it at 8 MiB.

Perf VM rerun and a #44 gate are follow-ups.

Progress: the search foundation is up for review in **PR #53** (API only; the palette waits for its own mockup). Interim speed, idle staging VM, 4 vCPU (the perf VM was busy with #14): | | 10k notes | 100k notes | |---|---|---| | all queries p50 / p95 | 6.8 / 8.2 ms | 20.3 / 31.7 ms | | worst query p95 | 8.5 ms | 38.6 ms | | re-index one edit (database work) p50 | 0.6 ms | 0.5 ms | | first build (background) | 3.3 s | 41 s | | index size | 71 MB | 681 MB | Budget: under 50 ms p95 at 10k. Met, and 100k stays under it too. What changed while measuring: - **Ranking cost.** Full ranking of every match (BM25) is now used only when matches are few. With many matches, cost stays flat by gathering title matches, the newest matches (row ids follow when things changed) and frecent ones. - **Snippets** are now cut in Rust. They were 12 ms of every search. - **The write-ahead log** grew without limit during a first build: 4 GB at 100k. The writer now checkpoints it in quiet moments and caps it at 8 MiB. Perf VM rerun and a #44 gate are follow-ups.
Author
Owner

Closing during the 26 Oct handover cleanup: Search foundation (PR #53) is in dev. The palette and the typo gate continue in #636 and #637.

Closing during the 26 Oct handover cleanup: Search foundation (PR #53) is in dev. The palette and the typo gate continue in #636 and #637.
kayg closed this issue 2026-10-26 08:45:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#10
No description provided.