Search the index for a given query, and return a result of documents ### Parameters - **query**: the search query. Either a text for simple queries with default parameters, or a Query object for complex queries. See RediSearch's do
(
self,
query: Union[str, Query],
query_params: Union[Dict[str, Union[str, int, float, bytes]], None] = None,
)
| 1249 | return args, query |
| 1250 | |
| 1251 | def search( |
| 1252 | self, |
| 1253 | query: Union[str, Query], |
| 1254 | query_params: Union[Dict[str, Union[str, int, float, bytes]], None] = None, |
| 1255 | ): |
| 1256 | class="st">""" |
| 1257 | Search the index for a given query, and return a result of documents |
| 1258 | |
| 1259 | class="cm">### Parameters |
| 1260 | |
| 1261 | - **query**: the search query. Either a text for simple queries with |
| 1262 | default parameters, or a Query object for complex queries. |
| 1263 | See RediSearch&class="cm">#x27;s documentation on query format |
| 1264 | |
| 1265 | For more information see `FT.SEARCH <https://redis.io/commands/ft.search>`_. |
| 1266 | class="st">""" class="cm"># noqa |
| 1267 | args, query = self._mk_query_args(query, query_params=query_params) |
| 1268 | st = time.monotonic() |
| 1269 | |
| 1270 | options = {} |
| 1271 | if not check_protocol_version(get_protocol_version(self.client), 3): |
| 1272 | options[NEVER_DECODE] = True |
| 1273 | if isinstance(self, Pipeline): |
| 1274 | options[class="st">"query"] = query |
| 1275 | options[class="st">"duration"] = 0 |
| 1276 | |
| 1277 | res = self.execute_command(SEARCH_CMD, *args, **options) |
| 1278 | |
| 1279 | if isinstance(res, Pipeline): |
| 1280 | return res |
| 1281 | |
| 1282 | return self._parse_results( |
| 1283 | SEARCH_CMD, res, query=query, duration=(time.monotonic() - st) * 1000.0 |
| 1284 | ) |
| 1285 | |
| 1286 | @experimental_method() |
| 1287 | def hybrid_search( |