redis / redis-py

Redis Python client
MIT License
12.54k stars 2.51k forks source link

Feature Request: make Document class subscriptable #2598

Closed omarghetti closed 1 year ago

omarghetti commented 1 year ago

Hello everyone! it is possibile to make the Document class from the redisearch module a subscriptable class? it would make it easier to access fields if someone needs to remap the search results to other structures in their code

example: for doc in result.docs: search_output.matches.append(Document(document_id=doc.id, value=doc[filter_name]))

The Document class that I'm using here is another class that i will extend with other values

right now, this code returns an error that tells:

TypeError: 'Document' object is not subscriptable

Thank you

dvora-h commented 1 year ago

fixed in #2615