From ed72027bbf36e933c8db069bd02b0163a84aef83 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Fri, 8 Nov 2019 23:00:29 +0100 Subject: Add basic pagination to search results The "deep paging problem" imposes some limit, which currently is a hardcoded default value, `deep_page_limit=2000` in `do_search`. Elasticsearch can be configured, too: > Note that from + size can not be more than the index.max_result_window index setting, which defaults to 10,000. -- https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-from-size --- python/fatcat_web/templates/container_search.html | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'python/fatcat_web/templates/container_search.html') diff --git a/python/fatcat_web/templates/container_search.html b/python/fatcat_web/templates/container_search.html index 7f6799dd..9e2aa10a 100644 --- a/python/fatcat_web/templates/container_search.html +++ b/python/fatcat_web/templates/container_search.html @@ -30,7 +30,26 @@ {% if found %} {% if found.results %} - Showing top {{ found.count_returned }} out of {{ found.count_found }} results for: {{ found.query.q }} + Showing + {% if found.offset == 0 %} + first + {% else %} + results {{ found.offset }} — + {% endif %} + {{ found.offset + found.count_returned }} out of {{ found.count_found }} results for: {{ found.query.q }} +
+ {% if found.offset > 0 %} + {% if found.offset - found.limit < 0 %} + Prev + {% else %} + Prev + {% endif %} + {% endif %} + + {% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %} + Next + {% endif %} + {% for entity in found.results %}

-- cgit v1.2.3