Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making search document subscriptable #2615

Merged
merged 13 commits into from
Mar 15, 2023
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