Skip to content

Commit faa05b6

Browse files
authored
Fix text unit incremental ID updates (#1734)
* Increment text_unit ids during incremental * Semver
1 parent a932b2d commit faa05b6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "patch",
3+
"description": "Properly increment text unit IDs during updates."
4+
}

graphrag/index/update/incremental_index.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ def _update_and_merge_text_units(
301301
lambda x: [entity_id_mapping.get(i, i) for i in x] if x is not None else x
302302
)
303303

304+
initial_id = old_text_units["human_readable_id"].max() + 1
305+
delta_text_units["human_readable_id"] = np.arange(
306+
initial_id, initial_id + len(delta_text_units)
307+
)
304308
# Merge the final text units
305309
return pd.concat([old_text_units, delta_text_units], ignore_index=True, copy=False)
306310

0 commit comments

Comments
 (0)