V3 S4 : recherche FTS + facettes (serveur + mobile)
Backend : search_tsv french + GIN (000020), SearchDocumentsVisible (nom + TS + faits, rang nom > TS > fait sûr > fait douteux, jamais d'exclusion), facettes issuer/type/montant/période sur GET /files/search (400 si malformée). Tests repo + handlers + migrations. Mobile (Room v21) : FTS4 files_fts + triggers partagés (fresh-install/migration, entité déclarée pour KSP, SQL aligné 21.json), searchDocuments offline (même rang, accents préservés) + UI filtres (émetteur, types chips, montants, période ISO, compteur, effacer). Contrat docs/api-v1.md, V3.md (S4 livré, migrations renumérotées links->000021, token->000022).
This commit is contained in:
@@ -422,6 +422,31 @@ func TestMigrationsUpDown(t *testing.T) {
|
||||
t.Error("CHECK fact_type manquant sur resource_facts après 000019")
|
||||
}
|
||||
|
||||
// --- 000020 : plein-texte ----------------------------------------------
|
||||
var tsvCol int
|
||||
err = conn.QueryRow(`
|
||||
SELECT COUNT(*) FROM information_schema.columns
|
||||
WHERE table_schema = 'public' AND table_name = 'resources' AND column_name = 'search_tsv'`).Scan(&tsvCol)
|
||||
if err != nil {
|
||||
t.Fatalf("search_tsv column: %v", err)
|
||||
}
|
||||
if tsvCol == 0 {
|
||||
t.Error("colonne resources.search_tsv manquante après 000020")
|
||||
}
|
||||
|
||||
var tsvIdx int
|
||||
err = conn.QueryRow(`
|
||||
SELECT COUNT(*) FROM pg_index i
|
||||
JOIN pg_class t ON t.oid = i.indrelid
|
||||
WHERE t.relname = 'resources' AND i.indisvalid
|
||||
AND pg_get_indexdef(i.indexrelid) LIKE '%idx_resources_search_tsv%'`).Scan(&tsvIdx)
|
||||
if err != nil {
|
||||
t.Fatalf("000020 index: %v", err)
|
||||
}
|
||||
if tsvIdx == 0 {
|
||||
t.Error("index idx_resources_search_tsv manquant après 000020")
|
||||
}
|
||||
|
||||
if err := MigrateDownDatabase(url); err != nil {
|
||||
t.Fatalf("migrate down: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user