docling-studio/document-parser/infra/neo4j
Pier-Jean Malandrino 5a2eaacd4d fix(neo4j): rewrite fetch_graph with CALL subqueries
Previous query chained 6 OPTIONAL MATCH clauses for edges with no
intervening WITH collect(), producing a cartesian product. At 6 pages
(~60 elements, ~300 edges) Neo4j hit 102% CPU and hung > 5min.

Rewritten with one CALL {} subquery per node/edge type: each block
returns a single row with its collected list — no multiplication across
types. 6-page doc now returns in 213ms (was: no return).

Python reshape code (queries.py:137-210) untouched — record keys and
edge map shape preserved.

Refs: https://neo4j.com/developer/kb/using-subqueries-to-control-the-scope-of-aggregations/
2026-04-20 10:13:18 +02:00
..
__init__.py feat(neo4j): Day 3 — ChunkWriter, graph API, GraphView, README 2026-04-20 10:13:18 +02:00
chunk_writer.py feat(neo4j): Day 3 — ChunkWriter, graph API, GraphView, README 2026-04-20 10:13:18 +02:00
driver.py feat(neo4j): Day 1 — compose service, driver, schema bootstrap 2026-04-20 10:13:18 +02:00
queries.py fix(neo4j): rewrite fetch_graph with CALL subqueries 2026-04-20 10:13:18 +02:00
schema.py feat(neo4j): Day 1 — compose service, driver, schema bootstrap 2026-04-20 10:13:18 +02:00
tree_reader.py feat(neo4j): Day 2 — TreeWriter, TreeReader, pipeline wiring 2026-04-20 10:13:18 +02:00
tree_writer.py feat(neo4j): Day 2 — TreeWriter, TreeReader, pipeline wiring 2026-04-20 10:13:18 +02:00