From e09b3364c757c984d412cf551fb2d1f214dea936 Mon Sep 17 00:00:00 2001 From: Joseph Smith Date: Thu, 13 Apr 2023 14:18:23 +0100 Subject: [PATCH] Check for date fields in weaviate meta update (#4371) Co-authored-by: Massimiliano Pippi --- haystack/document_stores/weaviate.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/haystack/document_stores/weaviate.py b/haystack/document_stores/weaviate.py index 4590cea96..ace1a0163 100644 --- a/haystack/document_stores/weaviate.py +++ b/haystack/document_stores/weaviate.py @@ -612,8 +612,9 @@ class WeaviateDocumentStore(KeywordDocumentStore): # Weaviate requires dates to be in RFC3339 format date_fields = self._get_date_properties(index) for date_field in date_fields: - if isinstance(meta[date_field], str): - meta[date_field] = convert_date_to_rfc3339(str(meta[date_field])) + if date_field in meta: + if isinstance(meta[date_field], str): + meta[date_field] = convert_date_to_rfc3339(str(meta[date_field])) self.weaviate_client.data_object.update(meta, class_name=index, uuid=id)