diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f30cdcf..d5bb9f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ ### Fixed - Resolved import issue with the Vertex AI Embeddings class. - Resolved issue where Neo4jWriter component would raise an error if the start or end node ID was not defined properly in the input. +- Resolved issue where relationship types was not escaped in the insert Cypher query. +- Improved query performance in Neo4jWriter. ### Changed - Moved the Embedder class to the neo4j_graphrag.embeddings directory for better organization alongside other custom embedders. diff --git a/src/neo4j_graphrag/neo4j_queries.py b/src/neo4j_graphrag/neo4j_queries.py index b26a529f..144ef178 100644 --- a/src/neo4j_graphrag/neo4j_queries.py +++ b/src/neo4j_graphrag/neo4j_queries.py @@ -53,9 +53,9 @@ ) UPSERT_RELATIONSHIP_QUERY = ( - "MATCH (start {{ id: $start_node_id }}) " - "MATCH (end {{ id: $end_node_id }}) " - "MERGE (start)-[r:{type}]->(end) " + "MATCH (start:__Entity__ {{ id: $start_node_id }}) " + "MATCH (end:__Entity__ {{ id: $end_node_id }}) " + "MERGE (start)-[r:`{type}`]->(end) " "WITH r SET r += $properties " "WITH r CALL {{ " "WITH r WITH r WHERE $embeddings IS NOT NULL "