summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redis/commands/search/document.py4
-rw-r--r--tests/test_search.py2
2 files changed, 6 insertions, 0 deletions
diff --git a/redis/commands/search/document.py b/redis/commands/search/document.py
index 5b30505..47534ec 100644
--- a/redis/commands/search/document.py
+++ b/redis/commands/search/document.py
@@ -11,3 +11,7 @@ class Document:
def __repr__(self):
return f"Document {self.__dict__}"
+
+ def __getitem__(self, item):
+ value = getattr(self, item)
+ return value
diff --git a/tests/test_search.py b/tests/test_search.py
index 57d4338..7a24281 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -140,7 +140,9 @@ def test_client(client):
for doc in res.docs:
assert doc.id
+ assert doc["id"]
assert doc.play == "Henry IV"
+ assert doc["play"] == "Henry IV"
assert len(doc.txt) > 0
# test no content