From 26d6bf7d8f1b7b54d9bcc39c47f283a7ae3e95a7 Mon Sep 17 00:00:00 2001 From: Gavin Wahl Date: Mon, 8 Jan 2024 14:17:43 -0700 Subject: [PATCH] len shouldn't return less than 0 https://github.com/django-haystack/django-haystack/pull/1601 --- haystack/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haystack/query.py b/haystack/query.py index 1be64658f..7b2e71076 100644 --- a/haystack/query.py +++ b/haystack/query.py @@ -86,7 +86,7 @@ def __len__(self): self._result_count = 0 # This needs to return the actual number of hits, not what's in the cache. - return self._result_count - self._ignored_result_count + return max(self._result_count - self._ignored_result_count, 0) def __iter__(self): if self._cache_is_full():