Skip to content

[bug] FTS5 full-text index is never backfilled on existing DBs — keyword search loses the pre-FTS corpus #1428

Closed

Description

@mstomar125

Severity: high · Confidence: high

node_fts is an external-content FTS5 table with INSERT/UPDATE/DELETE triggers that index only future writes (sqlite_store.rs:176-204). User DBs are never reset (the code even ships migrate_embedding_origin for exactly this reason, lines 227-236) but there is no one-time FTS rebuild, so any node predating the FTS table is absent from node_fts and never returned by bm25_search_roots (MATCH, line 2987).

Fix: after creating the FTS table/triggers, run the idempotent INSERT INTO node_fts(node_fts) VALUES('rebuild'); once.


Found via the 2026-06-18 multi-repo bug-hunt sweep. Confidence/severity from the sweep + spot-verification.

Activity

  1. mstomar125 commented on Jun 24, 2026

    @mstomar125
    ContributorAuthor

    Resolved in #1457. After the FTS triggers are created, a one-time idempotent INSERT INTO node_fts(node_fts) VALUES('rebuild') backfills the pre-FTS corpus — gated on the indexed-doc count (node_fts_docsize) differing from node, so a healthy DB doesn't re-index every startup. (count(*) FROM node_fts can't be the signal: external-content reads content rowids and always equals node count.) Test: an unindexed node becomes matchable after backfill.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions