From f06f3db647c81bc24fa9bdad33822ca6175c32eb Mon Sep 17 00:00:00 2001 From: shacharPash <93581407+shacharPash@users.noreply.github.com> Date: Wed, 21 Dec 2022 15:11:33 +0200 Subject: 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 --- redis/commands/search/query.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'redis/commands') 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: -- cgit v1.2.1