Refactor IMSDbLoaderComponent to update document metadata
This commit is contained in:
parent
64bcb971ad
commit
310886b0ba
1 changed files with 8 additions and 1 deletions
|
|
@ -20,4 +20,11 @@ class IMSDbLoaderComponent(CustomComponent):
|
||||||
metadata: Optional[Dict] = None,
|
metadata: Optional[Dict] = None,
|
||||||
web_path: str = "",
|
web_path: str = "",
|
||||||
) -> Document:
|
) -> Document:
|
||||||
return IMSDbLoader(metadata=metadata, web_path=web_path)
|
documents = IMSDbLoader(web_path=web_path).load()
|
||||||
|
if(metadata):
|
||||||
|
for document in documents:
|
||||||
|
if not document.metadata:
|
||||||
|
document.metadata = metadata
|
||||||
|
else:
|
||||||
|
document.metadata.update(metadata)
|
||||||
|
return documents
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue