abinazebinoy commited on
Commit
7b8375b
·
1 Parent(s): fa87992

fix(B-08,NEW-1): remove duplicate fulltext from SETUP_QUERIES; modern CREATE FULLTEXT INDEX syntax

Browse files

B-08: globalSearch fulltext index existed in three places: FULLTEXT_INDEX_QUERY
(informational, never called), SETUP_QUERIES (8-type CALL syntax, externally
run), and loader.py setup_schema() (20-type authoritative version). Running
SETUP_QUERIES externally tried to create a conflicting narrower index,
producing silent DatabaseError: index globalSearch already exists.
Removed from SETUP_QUERIES. loader.py is the single source of truth.

NEW-1: FULLTEXT_INDEX_QUERY used deprecated CALL db.index.fulltext.createNodeIndex
removed in Neo4j 5.x and AuraDB Free. Replaced with modern DDL:
CREATE FULLTEXT INDEX globalSearch IF NOT EXISTS FOR (n:...) ON EACH [...]

Files changed (1) hide show
  1. graph/schema.py +12 -18
graph/schema.py CHANGED
@@ -210,20 +210,17 @@ RELATIONSHIP_SCHEMAS = {
210
  # Run these once when setting up a new Neo4j database.
211
 
212
  # -- Full-text index (run once) -----------------------------------------------
213
- # This powers instant search across all labels and fields simultaneously.
 
 
214
  FULLTEXT_INDEX_QUERY = (
215
- # BUG-19 FIX: expanded from 8 to 16 node types + 14 searchable fields.
216
- # Auto-scales: add new node labels and field names to the lists below.
217
- "CALL db.index.fulltext.createNodeIndex("
218
- " \'globalSearch\',"
219
- " [\'Politician\',\'Company\',\'Contract\',\'AuditReport\',\'Scheme\',"
220
- " \'Ministry\',\'Party\',\'PressRelease\',\'Tender\',\'RegulatoryOrder\',"
221
- " \'EnforcementAction\',\'ElectoralBond\',\'InsolvencyOrder\',"
222
- " \'NGO\',\'CourtCase\',\'LocalBody\'],"
223
- " [\'name\',\'title\',\'aliases\',\'description\',\'item_desc\',"
224
- " \'buyer_org\',\'seller_name\',\'ngo_name\',\'company_name\',"
225
- " \'purchaser_name\',\'accused\',\'ministry\',\'constituency\',\'state\']"
226
- ")"
227
  )
228
 
229
  SETUP_QUERIES = [
@@ -242,11 +239,8 @@ SETUP_QUERIES = [
242
  "CREATE INDEX politician_name IF NOT EXISTS FOR (n:Politician) ON (n.name)",
243
  "CREATE INDEX company_name IF NOT EXISTS FOR (n:Company) ON (n.name)",
244
  "CREATE INDEX contract_date IF NOT EXISTS FOR (n:Contract) ON (n.order_date)",
245
- # Full-text index across all searchable labels and fields
246
- "CALL db.index.fulltext.createNodeIndex('globalSearch', "
247
- "['Politician','Company','Contract','AuditReport','Scheme','Ministry','Party','PressRelease'], "
248
- "['name','title','aliases','description','item_desc','buyer_org','cin','ministry','summary'])"
249
- " IF NOT EXISTS",
250
  ]
251
 
252
 
 
210
  # Run these once when setting up a new Neo4j database.
211
 
212
  # -- Full-text index (run once) -----------------------------------------------
213
+ # -- Full-text index (informational -- loader.py is the authoritative caller)
214
+ # NEW-1 FIX: replaced deprecated CALL db.index.fulltext.createNodeIndex
215
+ # (removed in Neo4j 5.x / AuraDB) with modern CREATE FULLTEXT INDEX syntax
216
  FULLTEXT_INDEX_QUERY = (
217
+ "CREATE FULLTEXT INDEX globalSearch IF NOT EXISTS "
218
+ "FOR (n:Politician|Company|Contract|AuditReport|Scheme|Ministry|"
219
+ " Party|PressRelease|Tender|RegulatoryOrder|EnforcementAction|"
220
+ " ElectoralBond|InsolvencyOrder|NGO|CourtCase|LocalBody|Affidavit) "
221
+ "ON EACH [n.name, n.title, n.aliases, n.description, n.item_desc, "
222
+ " n.buyer_org, n.seller_name, n.ngo_name, n.company_name, "
223
+ " n.accused, n.ministry, n.constituency, n.state]"
 
 
 
 
 
224
  )
225
 
226
  SETUP_QUERIES = [
 
239
  "CREATE INDEX politician_name IF NOT EXISTS FOR (n:Politician) ON (n.name)",
240
  "CREATE INDEX company_name IF NOT EXISTS FOR (n:Company) ON (n.name)",
241
  "CREATE INDEX contract_date IF NOT EXISTS FOR (n:Contract) ON (n.order_date)",
242
+ # B-08 FIX: fulltext index managed by loader.py setup_schema() only
243
+ # Removed conflicting 8-type CALL -- loader has the authoritative 20-type version
 
 
 
244
  ]
245
 
246