diff --git a/complaint_search/defaults.py b/complaint_search/defaults.py index 2e2db05..e30cf3f 100644 --- a/complaint_search/defaults.py +++ b/complaint_search/defaults.py @@ -19,7 +19,7 @@ # Pagination depth is the max hits that users can explore page by page. # The default result size matches the default for users of our search. # The trend_depth default limits display to 5 items in some Trends contexts. -PAGINATION_DEPTH_DEFAULT = 10000 +PAGINATION_DEPTH_DEFAULT = 1000 RESULT_SIZE_DEFAULT = 25 RESULT_SIZE_OPTIONS = [10, 50, 100] TREND_DEPTH_DEFAULT = 5 diff --git a/complaint_search/es_interface.py b/complaint_search/es_interface.py index 20aeedd..87912b4 100644 --- a/complaint_search/es_interface.py +++ b/complaint_search/es_interface.py @@ -63,9 +63,9 @@ def build_trend_meta(response): def get_break_points(hits, size): """Return a dict of 'search-after' values for pagination.""" - end_page = int(PAGINATION_DEPTH_DEFAULT / size) - 1 + end_page = int(PAGINATION_DEPTH_DEFAULT / size) break_points = {} - if size > len(hits): + if size >= len(hits): return break_points # we don't need a break point for page 1; start with page 2 page = 2