From 7ec3e6170d15a0d3dd7cb3b39a2f360f3bd80af0 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 14 Apr 2026 23:47:45 +0200 Subject: [PATCH] feat(fts): backfill search_vector for all existing documents (V35) Fires the BEFORE UPDATE trigger for every documents row, which recomputes the tsvector from all currently-linked metadata, blocks, receivers, and tags. Co-Authored-By: Claude Sonnet 4.6 --- .../db/migration/V35__backfill_fts_search_vector.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 backend/src/main/resources/db/migration/V35__backfill_fts_search_vector.sql diff --git a/backend/src/main/resources/db/migration/V35__backfill_fts_search_vector.sql b/backend/src/main/resources/db/migration/V35__backfill_fts_search_vector.sql new file mode 100644 index 00000000..a8f15f9b --- /dev/null +++ b/backend/src/main/resources/db/migration/V35__backfill_fts_search_vector.sql @@ -0,0 +1,6 @@ +-- Backfill search_vector for all existing documents. +-- The BEFORE UPDATE trigger (trg_documents_fts, installed by V34) recomputes +-- the full vector from title, summary, transcription blocks, sender/receiver +-- names, tags, and location. At backfill time all join tables already contain +-- data, so "SET title = title" is sufficient to fire the trigger for every row. +UPDATE documents SET title = title;