lint and correct cypher query code

This commit is contained in:
2025-12-03 10:42:32 +00:00
parent 64c6bd8bdd
commit c8fac06f24
3 changed files with 28 additions and 2 deletions

View File

@@ -154,13 +154,22 @@ CREATE (e)-[:AUTHORED_BY]->(a)
paramName := fmt.Sprintf("eTag_%d", eTagIndex)
params[paramName] = tagValue
// Add WITH clause before first OPTIONAL MATCH to transition from CREATE to MATCH
// Add WITH clause before OPTIONAL MATCH
// This is required because:
// 1. Cypher doesn't allow MATCH after CREATE without WITH
// 2. Cypher doesn't allow MATCH after FOREACH without WITH
// So we need WITH before EVERY OPTIONAL MATCH, not just the first
if needsWithClause {
cypher += `
// Carry forward event and author nodes for tag processing
WITH e, a
`
needsWithClause = false
} else {
// After a FOREACH, we need WITH to transition back to MATCH
cypher += `
WITH e, a
`
}
cypher += fmt.Sprintf(`