Conversation
oshadmi
left a comment
There was a problem hiding this comment.
What about supplying the parameters dict when executing a query (in Client.search or Client.aggregate)
So the parameter names are used in a query, and the query could be executed multiple times, each time with specific param values.
redisearch/query.py
Outdated
| self._params = params | ||
| return self | ||
|
|
||
| def add_param(self, param_name:str, value:Union[str, int, float]): |
There was a problem hiding this comment.
It could also set a value for an existing param, no?
| def add_param(self, param_name:str, value:Union[str, int, float]): | |
| def set_param(self, param_name:str, value:Union[str, int, float]): |
|
|
||
| def explain(self, query): | ||
| args, query_text = self._mk_query_args(query) | ||
| def explain(self, query, query_params: Dict[str, Union[str, int, float]] = None): |
There was a problem hiding this comment.
Incompatible variable type: query_params is declared to have type Dict[str, Union[float, int, str]] but is used as type None.
(at-me in a reply with help or ignore)
test/test.py
Outdated
| client.add_document('doc3', name='Carol') | ||
|
|
||
| params_dict = {"name1":"Alice", "name2":"Bob"} | ||
| q = Query("@name:($name1 | $name2 )").set_params_dict(params=params_dict) |
There was a problem hiding this comment.
I prefer to have something like:
params = {"name1":"Alice", "name2":"Bob"}
q = Query("@name:($name1 | $name2 )")
res1 = client.search(params=params)
res2 = client.search(params=other_params)
WDYT?
There was a problem hiding this comment.
we have it, continue reading the test ;)
redisearch/client.py
Outdated
| if query_params is not None: | ||
| args+= Query.get_params_args(query_params) |
There was a problem hiding this comment.
Do you want to use the member query._params if argument query_params is None?
(or even to merge both if both are not None, giving precedence to the argument over the member?)
Or do you want to get rid of the member? (it is only available for Query, not for AggregateRequest)
|
Kudos, SonarCloud Quality Gate passed!
|
|
Kudos, SonarCloud Quality Gate passed!
|
|
Should it also be supported in FT.PROFILE command? |
Should work, but not yet tested. |








Query params for
searchfunctionalitytested against
omer-query-paramsbranch