Skip to content

Commit 171aba3

Browse files
cgc clean accepted
1 parent 842616d commit 171aba3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/codegraphcontext/cli/cli_helpers.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,13 @@ def clean_helper():
423423
try:
424424
with db_manager.get_driver().session() as session:
425425
# Find and delete orphaned nodes (nodes not connected to any repository)
426+
# Using OPTIONAL MATCH for FalkorDB compatibility
426427
query = """
427428
MATCH (n)
428-
WHERE NOT (n:Repository) AND NOT EXISTS((n)-[]-(:Repository))
429+
WHERE NOT (n:Repository)
430+
OPTIONAL MATCH path = (n)-[*]-(r:Repository)
431+
WITH n, path
432+
WHERE path IS NULL
429433
WITH n LIMIT 1000
430434
DETACH DELETE n
431435
RETURN count(n) as deleted

0 commit comments

Comments
 (0)