Performs a search or aggregate command and collects performance information. ### Parameters **query**: This can be either an `AggregateRequest` or `Query`. **limited**: If set to True, removes details of reader iterator. **query_params**: Define one
(
self,
query: Union[Query, AggregateRequest],
limited: bool = False,
query_params: Optional[Dict[str, Union[str, int, float, bytes]]] = None,
)
| 1411 | return AggregateResult(rows, cursor, schema) |
| 1412 | |
| 1413 | def profile( |
| 1414 | self, |
| 1415 | query: Union[Query, AggregateRequest], |
| 1416 | limited: bool = False, |
| 1417 | query_params: Optional[Dict[str, Union[str, int, float, bytes]]] = None, |
| 1418 | ) -> Union[ |
| 1419 | tuple[Union[Result, AggregateResult], ProfileInformation], |
| 1420 | ProfileInformation, |
| 1421 | ]: |
| 1422 | """ |
| 1423 | Performs a search or aggregate command and collects performance |
| 1424 | information. |
| 1425 | |
| 1426 | ### Parameters |
| 1427 | |
| 1428 | **query**: This can be either an `AggregateRequest` or `Query`. |
| 1429 | **limited**: If set to True, removes details of reader iterator. |
| 1430 | **query_params**: Define one or more value parameters. |
| 1431 | Each parameter has a name and a value. |
| 1432 | |
| 1433 | """ |
| 1434 | st = time.monotonic() |
| 1435 | cmd = [PROFILE_CMD, self.index_name, ""] |
| 1436 | if limited: |
| 1437 | cmd.append("LIMITED") |
| 1438 | cmd.append("QUERY") |
| 1439 | |
| 1440 | if isinstance(query, AggregateRequest): |
| 1441 | cmd[2] = "AGGREGATE" |
| 1442 | cmd += query.build_args() |
| 1443 | elif isinstance(query, Query): |
| 1444 | cmd[2] = "SEARCH" |
| 1445 | cmd += query.get_args() |
| 1446 | cmd += self.get_params_args(query_params) |
| 1447 | else: |
| 1448 | raise ValueError("Must provide AggregateRequest object or Query object.") |
| 1449 | |
| 1450 | res = self.execute_command(*cmd) |
| 1451 | |
| 1452 | return self._parse_results( |
| 1453 | PROFILE_CMD, res, query=query, duration=(time.monotonic() - st) * 1000.0 |
| 1454 | ) |
| 1455 | |
| 1456 | def spellcheck(self, query, distance=None, include=None, exclude=None): |
| 1457 | """ |