Skip to content

Commit

Permalink
len shouldn't return less than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinwahl committed Jan 8, 2024
1 parent 14e824c commit 26d6bf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion haystack/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 26d6bf7

Please sign in to comment.