Skip to main content

ensure_fts_index

Function ensure_fts_index 

Source
pub fn ensure_fts_index(conn: &Connection) -> Result<(), Error>
Expand description

Ensures the symbols_fts (words) and symbol_names_tri (name trigrams) FTS5 virtual tables and their synchronization triggers exist in the SQLite database, and that both hold every symbol except locals and parameters. An index built under an earlier rule, or one left without content or without one of the tables, is repopulated once inside a single transaction; the rule marker is written last so an interrupted migration reruns. The migration takes the write lock up front, so a second process waits for the busy timeout instead of failing at once, and re-checks readiness under the lock so it never repeats a migration another process just finished. julie may write a local before its enclosing function, so the insert trigger also drops any same-file variable that became local when its parent arrived.