You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AutoMergingRetriever treats __level=0 / __block_size=0 as missing metadata #12634
HierarchicalDocumentSplitter intentionally sets __level=0 and __block_size=0 on the root document. When a document carries those values (field present, value zero), validation raises ValueError: The matched leaf documents do not have the required meta field '__level' even though the field exists.
Reproduction
fromhaystackimportDocumentfromhaystack.components.retrievers.auto_merging_retrieverimportAutoMergingRetrieverfromhaystack.document_stores.in_memoryimportInMemoryDocumentStorestore=InMemoryDocumentStore()
parent=Document(
content="parent",
id="parent1",
meta={"__level": 0, "__block_size": 0, "__children_ids": ["leaf1", "leaf2"]},
)
store.write_documents([parent])
leaf=Document(
content="leaf",
id="leaf1",
meta={"__parent_id": "parent1", "__level": 0, "__block_size": 0},
)
AutoMergingRetriever(store).run([leaf])
# ValueError: The matched leaf documents do not have the required meta field '__level'
Expected
Documents with __level / __block_size present should pass validation even when the value is 0.
Activity