summaryrefslogtreecommitdiff
path: root/redis/commands
diff options
context:
space:
mode:
authorshacharPash <93581407+shacharPash@users.noreply.github.com>2022-12-21 15:11:33 +0200
committerGitHub <noreply@github.com>2022-12-21 15:11:33 +0200
commitf06f3db647c81bc24fa9bdad33822ca6175c32eb (patch)
tree162cc1a214dd80b80bdc067408bdcf3b3736a778 /redis/commands
parentf28a9f589371e8967871998b7972c3755bb622b1 (diff)
downloadredis-py-f06f3db647c81bc24fa9bdad33822ca6175c32eb.tar.gz
Add TIMEOUT to query class (#2519)
* add timeout to query class * Add test_timeout * fix lines * fix format * add test & fixes * merge tests * change timeout to not_a_number * change q1 to q2 * Fix async method
Diffstat (limited to 'redis/commands')
-rw-r--r--redis/commands/search/query.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/redis/commands/search/query.py b/redis/commands/search/query.py
index e51918f..5071cfa 100644
--- a/redis/commands/search/query.py
+++ b/redis/commands/search/query.py
@@ -28,6 +28,7 @@ class Query:
self._filters = list()
self._ids = None
self._slop = -1
+ self._timeout = None
self._in_order = False
self._sortby = None
self._return_fields = []
@@ -131,6 +132,11 @@ class Query:
self._slop = slop
return self
+ def timeout(self, timeout):
+ """overrides the timeout parameter of the module"""
+ self._timeout = timeout
+ return self
+
def in_order(self):
"""
Match only documents where the query terms appear in
@@ -188,6 +194,8 @@ class Query:
args += self._ids
if self._slop >= 0:
args += ["SLOP", self._slop]
+ if self._timeout:
+ args += ["TIMEOUT", self._timeout]
if self._in_order:
args.append("INORDER")
if self._return_fields: