Skip to content

Commit 543816f

Browse files
committed
test(llama-index): clarify CoordiNode RETURN n and vector_search behaviour
Add detailed comments explaining: - In CoordiNode, CREATE ... RETURN n yields the internal integer node ID, not a property map — verified empirically (seed_rows[0]["nid"] == int) - vector_search returns Node(properties={}) so node.properties.get("id") is always None and cannot be used for node identification - ChunkNode.id_ == str(r.node.id) is the correct comparison target
1 parent f31a697 commit 543816f

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

tests/integration/adapters/test_llama_index.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,16 @@ def test_vector_query_returns_results(store, tag):
168168
# response format). vector_query() defaults label to "Chunk" when no
169169
# MetadataFilters are provided.
170170
try:
171-
# Capture the internal CoordiNode node ID (returned as integer by RETURN n) so
172-
# we can assert the specific seeded node is retrieved — not just any Chunk.
171+
# In CoordiNode, `CREATE (n:...) RETURN n` returns the internal integer node ID,
172+
# NOT a property map. This is CoordiNode-specific behaviour verified empirically:
173+
# seed_rows[0]["nid"] → 90 (int)
174+
# ChunkNode.id_ is set from vector_search's r.node.id (same internal integer),
175+
# so comparing str(node.id_) == str(seed_rows[0]["nid"]) correctly identifies
176+
# the specific seeded node.
177+
#
178+
# NOTE: vector_search returns Node(id=N, properties={}) — the properties dict is
179+
# always EMPTY, so node.properties.get("id") would always be None and cannot be
180+
# used for identification.
173181
seed_rows = store._client.cypher(
174182
"CREATE (n:Chunk {id: $id, text: $text, embedding: $vec}) RETURN n AS nid",
175183
params={"id": f"vec-{tag}", "text": "test chunk", "vec": vec},
@@ -181,8 +189,7 @@ def test_vector_query_returns_results(store, tag):
181189
assert isinstance(nodes, list)
182190
assert isinstance(scores, list)
183191
assert len(nodes) >= 1
184-
# vector_search returns CoordiNode internal node IDs (ChunkNode.id_);
185-
# verify our seeded node is the one found.
192+
# ChunkNode.id_ == str(r.node.id) == internal CoordiNode node ID captured above.
186193
assert any(str(getattr(node, "id_", "")) == seeded_internal_id for node in nodes)
187194
assert len(scores) == len(nodes)
188195
assert scores[0] >= 0.0

0 commit comments

Comments
 (0)