From a5d553a05848c3311c122235b456c272fa2edf5a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 19 Aug 2016 14:36:23 +0100 Subject: [PATCH] [PASSED QA] Bug 17048: Fix pagination offset for authority searches At the intranet, the pagination has been broken by bug 12478 (Elastic Search). There was a confusion between the offset and the page number. At the OPAC, it is broken since bug 2735 which has mimicked the intranet script. Test plan: Search for a term which will return more than 1 page of results. Click on the second page => Without this patch, the first result of the second page is the second result of the first page => With this patch applied, the offset will be corrected Signed-off-by: Aleisha Amohia Signed-off-by: Katrin Fischer --- authorities/authorities-home.pl | 4 ++-- opac/opac-authorities-home.pl | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index 426b1ba..6e0a8fe 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -87,9 +87,9 @@ if ( $op eq "do_search" ) { [$marclist], [$and_or], [$excluding], [$operator], [$value], $authtypecode, $orderby ); - $startfrom = $startfrom // 0; + my $offset = ( $startfrom - 1 ) * $resultsperpage + 1; my ( $results, $total ) = - $searcher->search_auth_compat( $search_query, $startfrom, + $searcher->search_auth_compat( $search_query, $offset, $resultsperpage ); #my ( $results, $total ) = SearchAuthorities( # [$marclist], [$and_or], diff --git a/opac/opac-authorities-home.pl b/opac/opac-authorities-home.pl index 5b1a42b..d92166b 100755 --- a/opac/opac-authorities-home.pl +++ b/opac/opac-authorities-home.pl @@ -64,8 +64,9 @@ if ( $op eq "do_search" ) { { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); my $search_query = $builder->build_authorities_query_compat( \@marclist, \@and_or, \@excluding, \@operator, \@value, $authtypecode, $orderby ); + my $offset = ( $startfrom - 1 ) * $resultsperpage + 1; my ( $results, $total ) = - $searcher->search_auth_compat( $search_query, $startfrom, $resultsperpage ); + $searcher->search_auth_compat( $search_query, $offset, $resultsperpage ); ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "opac-authoritiessearchresultlist.tt", -- 2.1.4