Bugzilla – Attachment 76788 Details for
Bug 19502
Result sets limited to 10000
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19502: Limit pagination to first 10000 results when using ES
Bug-19502-Limit-pagination-to-first-10000-results-.patch (text/plain), 5.68 KB, created by
Nick Clemens
on 2018-07-09 11:51:46 UTC
(
hide
)
Description:
Bug 19502: Limit pagination to first 10000 results when using ES
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2018-07-09 11:51:46 UTC
Size:
5.68 KB
patch
obsolete
>From 371e58089373ca9938f37a31cddbbe8b966e2378 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 16 Mar 2018 11:10:37 +0000 >Subject: [PATCH] Bug 19502: Limit pagination to first 10000 results when using > ES >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch is to avoid hitting an error page. We should eventually make the >max number returned configurable for ES. > >To test: >1 - Have Koha running ES with 10,000+ records >2 - Search for '*' >3 - Click 'Last' to view last page of results >4 - 'Cannot perform search' error >5 - Apply patch >6 - Search again >7 - View 'Last' page >8 - No error, you go to the last of 10000 >9 - Note the warning above the pagination buttons > >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > catalogue/search.pl | 3 ++- > koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc | 1 + > koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt | 1 - > koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc | 1 + > koha-tmpl/opac-tmpl/bootstrap/en/includes/search/page-numbers.inc | 1 + > opac/opac-search.pl | 3 ++- > 6 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 6fc96d6..7e2e300 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -619,8 +619,9 @@ for (my $i=0;$i<@servers;$i++) { > ## FIXME: add a global function for this, it's better than the current global one > ## Build the page numbers on the bottom of the page > my @page_numbers; >+ my $hits_to_paginate = C4::Context->preference('SearchEngine') eq 'Elasticsearch' ? 10000 : $hits; > # total number of pages there will be >- my $pages = ceil($hits / $results_per_page); >+ my $pages = ceil($hits_to_paginate / $results_per_page); > my $last_page_offset = ( $pages -1 ) * $results_per_page; > # default page number > my $current_page_number = 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc >index af4bc09..387d09f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc >@@ -1,4 +1,5 @@ > [% IF ( PAGE_NUMBERS ) %]<nav><ul class="pagination"> >+ [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]<h6>10,000 results loaded, refine your search to view other records</h6>[% END %] > [% IF ( previous_page_offset.defined ) %] > <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %]">First</a></li> > <!-- Row of numbers corresponding to search result pages --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index c2fb64c..0b7c63d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -337,7 +337,6 @@ > [% ELSE %] > > <div id="searchresults"> >- > [% INCLUDE 'page-numbers.inc' %] > > <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >index fbfdfc8..484fa5c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >@@ -1,5 +1,6 @@ > [% IF ( PAGE_NUMBERS ) %] > <div class="pagination pagination-small noprint"> >+ [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]<h6>10000 results loaded, refine your search to view other records</h6>[% END %] > <ul> > [% IF ( previous_page_offset.defined ) %] > <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">First</a></li> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/search/page-numbers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/search/page-numbers.inc >index 2de511f..807417b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/search/page-numbers.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/search/page-numbers.inc >@@ -1,5 +1,6 @@ > [% IF ( PAGE_NUMBERS ) %] > <div class="pages"> >+ [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]<h6>10000 results loaded, refine your search to view other records</h6>[% END %] > [% IF ( previous_page ) %] > <a class="nav" href="?[% FOREACH fp IN follower_params %][% fp.var |url %]=[% fp.val |url %]&[% END %]page=[% previous_page |url %]"><< Previous</a> > [% END %] >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 1d7615b..9cfb3fa 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -830,8 +830,9 @@ for (my $i=0;$i<@servers;$i++) { > } > ## Build the page numbers on the bottom of the page > my @page_numbers; >+ my $hits_to_paginate = C4::Context->preference('SearchEngine') eq 'Elasticsearch' ? 10000 : $hits; > # total number of pages there will be >- my $pages = ceil($hits / $results_per_page); >+ my $pages = ceil($hits_to_paginate / $results_per_page); > my $last_page_offset = ( $pages - 1 ) * $results_per_page; > # default page number > my $current_page_number = 1; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19502
:
73020
|
73024
|
74587
|
75816
|
76371
|
76372
|
76788
|
76789
|
76790
|
76791
|
76792
|
76794
|
76795
|
76796
|
76798
|
76799