Skip to content

Commit 3bd062f

Browse files
committed
Fix async SEARCH pipeline (#2316)
* fix search async pipeline * newline
1 parent f9ea68f commit 3bd062f

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

redis/commands/search/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,5 @@ class Pipeline(SearchCommands, redis.client.Pipeline):
167167
"""Pipeline for the module."""
168168

169169

170-
class AsyncPipeline(AsyncSearchCommands, AsyncioPipeline):
170+
class AsyncPipeline(AsyncSearchCommands, AsyncioPipeline, Pipeline):
171171
"""AsyncPipeline for the module."""

tests/test_asyncio/test_search.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from redis.commands.search.query import GeoFilter, NumericFilter, Query
1717
from redis.commands.search.result import Result
1818
from redis.commands.search.suggestion import Suggestion
19-
from tests.conftest import skip_ifmodversion_lt
19+
from tests.conftest import skip_if_redis_enterprise, skip_ifmodversion_lt
2020

2121
pytestmark = pytest.mark.asyncio
2222

@@ -1046,3 +1046,22 @@ async def test_aggregations_sort_by_and_limit(modclient: redis.Redis):
10461046
res = await modclient.ft().aggregate(req)
10471047
assert len(res.rows) == 1
10481048
assert res.rows[0] == ["t1", "b"]
1049+
1050+
1051+
@pytest.mark.redismod
1052+
@skip_if_redis_enterprise()
1053+
async def test_search_commands_in_pipeline(modclient: redis.Redis):
1054+
p = await modclient.ft().pipeline()
1055+
p.create_index((TextField("txt"),))
1056+
p.add_document("doc1", payload="foo baz", txt="foo bar")
1057+
p.add_document("doc2", txt="foo bar")
1058+
q = Query("foo bar").with_payloads()
1059+
await p.search(q)
1060+
res = await p.execute()
1061+
assert res[:3] == ["OK", "OK", "OK"]
1062+
assert 2 == res[3][0]
1063+
assert "doc1" == res[3][1]
1064+
assert "doc2" == res[3][4]
1065+
assert "foo baz" == res[3][2]
1066+
assert res[3][5] is None
1067+
assert res[3][3] == res[3][6] == ["txt", "foo bar"]

0 commit comments

Comments
 (0)