From aebd76485cee76ad47ddb5ba36e66960def6bd0c Mon Sep 17 00:00:00 2001 From: aksinha334 Date: Tue, 14 Mar 2023 23:55:31 +0530 Subject: [PATCH 1/2] Fixed issue #2598 - make Document class subscriptable --- redis/commands/search/document.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/redis/commands/search/document.py b/redis/commands/search/document.py index 5b3050545a..43ebc3713b 100644 --- a/redis/commands/search/document.py +++ b/redis/commands/search/document.py @@ -11,3 +11,6 @@ def __init__(self, id, payload=None, **fields): def __repr__(self): return f"Document {self.__dict__}" + + def __getitem__(self, item): + return self.Document[item] From fb4ba68eb3bf6ca7d36efdfb34e82c901a5626e9 Mon Sep 17 00:00:00 2001 From: aksinha334 Date: Wed, 15 Mar 2023 00:01:04 +0530 Subject: [PATCH 2/2] Last time added older file, fixed it --- redis/commands/search/document.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redis/commands/search/document.py b/redis/commands/search/document.py index 43ebc3713b..47534ec248 100644 --- a/redis/commands/search/document.py +++ b/redis/commands/search/document.py @@ -13,4 +13,5 @@ def __repr__(self): return f"Document {self.__dict__}" def __getitem__(self, item): - return self.Document[item] + value = getattr(self, item) + return value