Description
The RediSearch search command returns an instance of the Result
class except when the Redis client is a Pipeline
because Pipeline
returns itself instead of a result when you execute a command. There's code that checks for this in both the SearchCommands
and AsyncSearchCommands
classes:
redis-py/redis/commands/search/commands.py
Line 414 in 4b0543d
redis-py/redis/commands/search/commands.py
Line 883 in 4b0543d
However, this check doesn't work if the
Pipeline
is from the redis.asyncio.client
module. The following modification should fix the issue:
from redis.client import Pipeline
from redis.asyncio.client import Pipeline as AsyncPipeline
...
if isinstance(res, Pipeline) or isinstance(res, AsyncPipeline):
return res
...
I'm not sure if it makes sense to check for both Pipeline
types or if the SearchCommands
class should check for just Pipeline
and the AsyncSearchCommands
class should check for just AsyncPipeline
. Let me know and I can make a PR. Or feel free to make the changes yourself if that's easier. Thanks!