fix bug in cypher code that breaks queries
Some checks failed
Go / build-and-release (push) Has been cancelled

This commit is contained in:
2025-12-02 19:10:50 +00:00
parent ebef8605eb
commit feae79af1a
2 changed files with 14 additions and 1 deletions

View File

@@ -134,6 +134,10 @@ CREATE (e)-[:AUTHORED_BY]->(a)
eTagIndex := 0
pTagIndex := 0
// Track if we need to add WITH clause before OPTIONAL MATCH
// This is required because Cypher doesn't allow MATCH after CREATE without WITH
needsWithClause := true
// Only process tags if they exist
if ev.Tags != nil {
for _, tagItem := range *ev.Tags {
@@ -150,6 +154,15 @@ 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
if needsWithClause {
cypher += `
// Carry forward event and author nodes for tag processing
WITH e, a
`
needsWithClause = false
}
cypher += fmt.Sprintf(`
// Reference to event (e-tag)
OPTIONAL MATCH (ref%d:Event {id: $%s})