Skip to content

Commit

Permalink
Merge pull request #186 from cfpb/reduce-pagination-depth
Browse files Browse the repository at this point in the history
Reduce pagination depth to 1K
  • Loading branch information
higs4281 authored Feb 10, 2022
2 parents dd43a0f + 2b5832c commit ea5c7f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion complaint_search/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions complaint_search/es_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ea5c7f3

Please sign in to comment.