mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-09 21:32:10 +02:00
The id field in pipeline Metadata was being overwritten at each processing (#686)
The id field in pipeline Metadata was being overwritten at each processing stage (document → page → chunk), causing knowledge storage to create separate cores per chunk instead of grouping by document. Add a root field that: - Is set by librarian to the original document ID - Is copied unchanged through PDF decoder, chunkers, and extractors - Is used by knowledge storage for document_id grouping (with fallback to id) Changes: - Add root field to Metadata schema with empty string default - Set root=document.id in librarian when initiating document processing - Copy root through PDF decoder, recursive chunker, and all extractors - Update knowledge storage to use root (or id as fallback) for grouping - Add root handling to translators and gateway serialization - Update test mock Metadata class to include root parameter
This commit is contained in:
parent
aa4f5c6c00
commit
286f762369
15 changed files with 48 additions and 4 deletions
|
|
@ -104,6 +104,7 @@ class Processor(FlowProcessor):
|
|||
tpls = Triples(
|
||||
metadata = Metadata(
|
||||
id = metadata.id,
|
||||
root = metadata.root,
|
||||
user = metadata.user,
|
||||
collection = metadata.collection,
|
||||
),
|
||||
|
|
@ -116,6 +117,7 @@ class Processor(FlowProcessor):
|
|||
ecs = EntityContexts(
|
||||
metadata = Metadata(
|
||||
id = metadata.id,
|
||||
root = metadata.root,
|
||||
user = metadata.user,
|
||||
collection = metadata.collection,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ class Processor(FlowProcessor):
|
|||
flow("triples"),
|
||||
Metadata(
|
||||
id=v.metadata.id,
|
||||
root=v.metadata.root,
|
||||
user=v.metadata.user,
|
||||
collection=v.metadata.collection,
|
||||
),
|
||||
|
|
@ -231,6 +232,7 @@ class Processor(FlowProcessor):
|
|||
flow("entity-contexts"),
|
||||
Metadata(
|
||||
id=v.metadata.id,
|
||||
root=v.metadata.root,
|
||||
user=v.metadata.user,
|
||||
collection=v.metadata.collection,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -554,6 +554,7 @@ class Processor(FlowProcessor):
|
|||
t = Triples(
|
||||
metadata=Metadata(
|
||||
id=metadata.id,
|
||||
root=metadata.root,
|
||||
user=metadata.user,
|
||||
collection=metadata.collection,
|
||||
),
|
||||
|
|
@ -566,6 +567,7 @@ class Processor(FlowProcessor):
|
|||
ec = EntityContexts(
|
||||
metadata=Metadata(
|
||||
id=metadata.id,
|
||||
root=metadata.root,
|
||||
user=metadata.user,
|
||||
collection=metadata.collection,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ class Processor(FlowProcessor):
|
|||
flow("triples"),
|
||||
Metadata(
|
||||
id=v.metadata.id,
|
||||
root=v.metadata.root,
|
||||
user=v.metadata.user,
|
||||
collection=v.metadata.collection,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ class Processor(FlowProcessor):
|
|||
extracted = ExtractedObject(
|
||||
metadata=Metadata(
|
||||
id=f"{v.metadata.id}:{schema_name}",
|
||||
root=v.metadata.root,
|
||||
user=v.metadata.user,
|
||||
collection=v.metadata.collection,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue