diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-03-31 11:54:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 11:54:20 +0300 |
commit | bdae7899f66a14f35ece0e815685ae405ac2c824 (patch) | |
tree | b60c2aef9d1130d2b3229d5fcac85b21770a9a4c /redis/commands/search/query.py | |
parent | 0a5e4861a05c34d927e5cf1831b8515cb2094e1e (diff) | |
download | redis-py-bdae7899f66a14f35ece0e815685ae405ac2c824.tar.gz |
Add dialect support for RediSearch queries (#2071)
* Add dialect support for RediSearch queries
* type hints
Co-authored-by: Chayim <chayim@users.noreply.github.com>
Diffstat (limited to 'redis/commands/search/query.py')
-rw-r--r-- | redis/commands/search/query.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/redis/commands/search/query.py b/redis/commands/search/query.py index 2bb8347..e51918f 100644 --- a/redis/commands/search/query.py +++ b/redis/commands/search/query.py @@ -35,6 +35,7 @@ class Query: self._highlight_fields = [] self._language = None self._expander = None + self._dialect = None def query_string(self): """Return the query string of this query only.""" @@ -202,6 +203,8 @@ class Query: args += ["LANGUAGE", self._language] if self._expander: args += ["EXPANDER", self._expander] + if self._dialect: + args += ["DIALECT", self._dialect] return args @@ -288,6 +291,15 @@ class Query: self._expander = expander return self + def dialect(self, dialect: int) -> "Query": + """ + Add a dialect field to the query. + + - **dialect** - dialect version to execute the query under + """ + self._dialect = dialect + return self + class Filter: def __init__(self, keyword, field, *args): |