Closed
Description
Version: 4.6.0 or any above 4.4.1 given the timeout parameter was introduced there (https://github.com/redis/redis-py/releases/tag/v4.4.1)
Description: I was checking why we where not seeing the timeout parameter on a RediSearch query monitor with timeout(0) which means unlimited execution time on RediSearch.
Given the following:
q = (
Query(
f"{prefilter_condition}=>[KNN $K @vector $vec_param EF_RUNTIME $EF AS vector_score]"
)
.sort_by("vector_score", asc=False)
.paging(0, top)
.return_fields("vector_score")
.dialect(2)
.timeout(0)
)
notice that on the output of q.get_args() we're missing the TIMEOUT 0
:
['*=>[KNN $K @vector $vec_param EF_RUNTIME $EF AS vector_score]', 'RETURN', 1, 'vector_score', 'SORTBY', 'vector_score', 'DESC', 'DIALECT', 2, 'LIMIT', 0, 100]
checking the code we see that the integer 0 will be interpreted as False on the condition https://github.com/redis/redis-py/blob/master/redis/commands/search/query.py#L197
if self._timeout:
args += ["TIMEOUT", self._timeout]