Skip to content

Commit aa7435d

Browse files
committed
Doc update
1 parent a5587a7 commit aa7435d

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
- The reserved `id` property on `__KGBuilder__` nodes is removed.
3232
- The `chunk_index` property on `__Entity__` nodes is removed. Use the `FROM_CHUNK` relationship instead.
33+
- The `__entity__id` index is not used anymore and can be dropped from the database (it has been replaced by `__entity__tmp_internal_id`).
34+
3335

3436
## 1.7.0
3537

docs/source/user_guide_kg_builder.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,11 @@ to a Neo4j database:
10801080
Adjust the batch_size parameter of `Neo4jWriter` to optimize insert performance.
10811081
This parameter controls the number of nodes or relationships inserted per batch, with a default value of 1000.
10821082

1083+
.. note:: Index
1084+
1085+
In order to improve the ingestion performances, a index called `__entity__tmp_internal_id` is automatically added to the database.
1086+
1087+
10831088
See :ref:`neo4jgraph`.
10841089

10851090

src/neo4j_graphrag/experimental/components/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Neo4jNode(BaseModel):
8383
"""Represents a Neo4j node.
8484
8585
Attributes:
86-
id (str): The element ID of the node. This ID is used to refer to the node for relationship creation.
86+
id (str): The ID of the node. This ID is used to refer to the node for relationship creation.
8787
label (str): The label of the node.
8888
properties (dict[str, Any]): A dictionary of properties attached to the node.
8989
embedding_properties (Optional[dict[str, list[float]]]): A list of embedding properties attached to the node.

src/neo4j_graphrag/neo4j_queries.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def db_cleaning_query(support_variable_scope_clause: bool, batch_size: int) -> s
132132
f"{call_prefix} "
133133
" SET n.__tmp_internal_id = NULL "
134134
"} "
135-
f"IN TRANSACTIONS OF {batch_size} ROWS"
135+
f"IN TRANSACTIONS OF {batch_size} ROWS "
136+
"ON ERROR CONTINUE"
136137
)
137138

138139

tests/e2e/experimental/test_kg_writer_component_e2e.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ async def test_kg_writer(driver: neo4j.Driver) -> None:
8787

8888
rel = record["r"]
8989
assert rel.type == relationship.type
90+
assert relationship.start_node_id == rel.start_node.get("id")
91+
assert relationship.end_node_id == rel.end_node.get("id")
9092
assert rel.start_node.get("id") == start_node.properties.get("id")
9193
assert rel.end_node.get("id") == end_node.properties.get("id")
9294

tests/unit/experimental/components/test_kg_writer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ def test_upsert_nodes(_: Mock, driver: MagicMock) -> None:
6161
)
6262
neo4j_writer = Neo4jWriter(driver=driver)
6363
node = Neo4jNode(id="1", label="Label", properties={"key": "value"})
64-
neo4j_writer._upsert_nodes(
65-
nodes=[node], lexical_graph_config=LexicalGraphConfig()
66-
)
64+
neo4j_writer._upsert_nodes(nodes=[node], lexical_graph_config=LexicalGraphConfig())
6765
driver.execute_query.assert_called_once_with(
6866
upsert_node_query(False),
6967
parameters_={

0 commit comments

Comments
 (0)