Skip to content
4 changes: 4 additions & 0 deletions redis/commands/search/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ def __init__(self, id, payload=None, **fields):

def __repr__(self):
return f"Document {self.__dict__}"

def __getitem__(self, item):
value = getattr(self, item)
return value
2 changes: 2 additions & 0 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down