Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the search results to 10000 records & corresponding # of pages #4993

Merged
merged 1 commit into from
Sep 24, 2019

Conversation

njkim
Copy link
Collaborator

@njkim njkim commented Jul 10, 2019

Types of changes

Limit the search result pagination to match the elastic search results limit (default is 10,000) by adding parameter in settings.py and limiting the total number for pagination to 10,000, re# 4318

paging_filter.py, settings.py

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

Issues Solved

Now, only 400 pages (the number of pages that corresponds to 10,000 with 25 records per page) are shown in the page selector. The total number of records are still showing the correct total.

Checklist

  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Ticket Background

  • Sponsored by:
  • Found by: @
  • Tested by: @
  • Designed by: @

Further comments

@@ -34,7 +34,7 @@ def append_dsl(self, search_results_object, permitted_nodegroups, include_provis
search_results_object['query'].limit = limit

def post_search_hook(self, search_results_object, results, permitted_nodegroups):
total = results['hits']['total']
total = results['hits']['total'] if results['hits']['total'] <= settings.SEARCH_RESULT_LIMIT else settings.SEARCH_RESULT_LIMIT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (134 > 119 characters)

@@ -467,6 +467,7 @@
SEARCH_DROPDOWN_LENGTH = 100
SEARCH_TERM_SENSITIVITY = 3 # a lower number will give more "Fuzzy" matches, recomend between 0-4, see "prefix_length" at https://www.elastic.co/guide/en/elasticsearch/reference/6.7/query-dsl-fuzzy-query.html#_parameters_7
WORDS_PER_SEARCH_TERM = 10 # set to None for unlimited number of words allowed for search terms
SEARCH_RESULT_LIMIT = 10000 # should be less than or equal to elasticsearch configuration, index.max_result_window (default = 10,000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E261 at least two spaces before inline comment
E501 line too long (133 > 119 characters)

@coveralls
Copy link

Coverage Status

Coverage remained the same at ?% when pulling 421c518 on njkim:4318_fix_search_pagination into 33c56b8 on archesproject:master.

@chiatt chiatt merged commit ed98bdf into archesproject:master Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants