abinazebinoy commited on
Commit
9b088fe
·
1 Parent(s): 13a53d3

fix(M-08): add pressrelease alias in LABEL_QUERIES so frontend filter button works

Browse files
Files changed (1) hide show
  1. api/routes/search.py +11 -1
api/routes/search.py CHANGED
@@ -110,7 +110,17 @@ LABEL_QUERIES = {
110
  "MATCH (n:NGO) "
111
  "WHERE toLower(coalesce(n.ngo_name,'')) CONTAINS toLower($q) "
112
  "RETURN n.id AS id, n.ngo_name AS name, n.state AS state, null AS party LIMIT $limit"),
113
- # BUG-18 FIX: key renamed from "pressrelease" to "pib" to match scraper key,
 
 
 
 
 
 
 
 
 
 
114
  # so SOURCE_MAP lookup returns the correct PIB attribution.
115
  # M-08 FIX: frontend sends type=pressrelease but key is "pib".
116
  # Add alias so filter button works correctly.
 
110
  "MATCH (n:NGO) "
111
  "WHERE toLower(coalesce(n.ngo_name,'')) CONTAINS toLower($q) "
112
  "RETURN n.id AS id, n.ngo_name AS name, n.state AS state, null AS party LIMIT $limit"),
113
+ # M-08 FIX: frontend filter button sends type=pressrelease (lowercased label)
114
+ # but LABEL_QUERIES key is 'pib'. Add alias so both spellings work.
115
+ "pressrelease": ("PressRelease",
116
+ "MATCH (n:PressRelease) "
117
+ "WHERE toLower(coalesce(n.title, n.headline, '')) CONTAINS toLower($q) "
118
+ " OR toLower(coalesce(n.ministry, '')) CONTAINS toLower($q) "
119
+ "RETURN n.id AS entity_id, 'PressRelease' AS entity_type, "
120
+ "coalesce(n.title, n.headline, n.id) AS name, n.source AS source "
121
+ "LIMIT $lim"
122
+ ),
123
+ # BUG-18 FIX: key renamed from "pressrelease" to "pib" to match scraper key,
124
  # so SOURCE_MAP lookup returns the correct PIB attribution.
125
  # M-08 FIX: frontend sends type=pressrelease but key is "pib".
126
  # Add alias so filter button works correctly.