Skip to content

Commit 0568afa

Browse files
committed
Fix async
1 parent ab3f79a commit 0568afa

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

redis/commands/search/commands.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ async def search(
928928
""" # noqa
929929
args, query = self._mk_query_args(query, query_params=query_params)
930930
st = time.time()
931-
res = await self.execute_command(SEARCH_CMD, *args)
931+
options = {NEVER_DECODE: True}
932+
res = await self.execute_command(SEARCH_CMD, *args, **options)
932933

933934
if isinstance(res, Pipeline):
934935
return res

tests/test_asyncio/test_search.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,12 +1572,12 @@ async def test_query_timeout(decoded_r: redis.Redis):
15721572

15731573
@pytest.mark.redismod
15741574
@skip_if_resp_version(3)
1575-
async def test_binary_and_text_fields(client):
1575+
async def test_binary_and_text_fields(decoded_r: redis.Redis):
15761576
fake_vec = np.array([0.1, 0.2, 0.3, 0.4], dtype=np.float32)
15771577

15781578
index_name = "mixed_index"
15791579
mixed_data = {"first_name": "🐍python", "vector_emb": fake_vec.tobytes()}
1580-
await client.hset(f"{index_name}:1", mapping=mixed_data)
1580+
await decoded_r.hset(f"{index_name}:1", mapping=mixed_data)
15811581

15821582
schema = (
15831583
TagField("first_name"),
@@ -1592,7 +1592,7 @@ async def test_binary_and_text_fields(client):
15921592
),
15931593
)
15941594

1595-
await client.ft(index_name).create_index(
1595+
await decoded_r.ft(index_name).create_index(
15961596
fields=schema,
15971597
definition=IndexDefinition(
15981598
prefix=[f"{index_name}:"], index_type=IndexType.HASH
@@ -1604,7 +1604,7 @@ async def test_binary_and_text_fields(client):
16041604
.return_field("vector_emb", decode_field=False)
16051605
.return_field("first_name")
16061606
)
1607-
result = await client.ft(index_name).search(query=query, query_params={})
1607+
result = await decoded_r.ft(index_name).search(query=query, query_params={})
16081608
docs = result.docs
16091609

16101610
decoded_vec_from_search_results = np.frombuffer(

0 commit comments

Comments
 (0)