MCPcopy Index your code
hub / github.com/django-haystack/django-haystack / get_count

Method get_count

haystack/backends/__init__.py:638–660  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 4

__len__Method · 0.80
_fill_cacheMethod · 0.80
test_more_like_thisMethod · 0.80

Calls 3

run_mltMethod · 0.95
run_rawMethod · 0.95
runMethod · 0.95

Tested by 2

test_more_like_thisMethod · 0.64