Returns the number of results the backend found for the query. If the query has not been run, this will execute the query and store the results.
(self)
| 636 | self._spelling_suggestion = results.get("spelling_suggestion", None) |
| 637 | |
| 638 | def get_count(self): |
| 639 | """ |
| 640 | Returns the number of results the backend found for the query. |
| 641 | |
| 642 | If the query has not been run, this will execute the query and store |
| 643 | the results. |
| 644 | """ |
| 645 | if self._hit_count is None: |
| 646 | # Limit the slice to 1 so we get a count without consuming |
| 647 | # everything. |
| 648 | if not self.end_offset: |
| 649 | self.end_offset = 1 |
| 650 | |
| 651 | if self._more_like_this: |
| 652 | # Special case for MLT. |
| 653 | self.run_mlt() |
| 654 | elif self._raw_query: |
| 655 | # Special case for raw queries. |
| 656 | self.run_raw() |
| 657 | else: |
| 658 | self.run() |
| 659 | |
| 660 | return self._hit_count |
| 661 | |
| 662 | def get_results(self, **kwargs): |
| 663 | """ |