Bugzilla – Attachment 80158 Details for
Bug 21405
Pagination in authorities search broken for Zebra and broken for 10000+ results in ES
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21405: Fix authorities pagination for Zebra and ES
Bug-21405-Fix-authorities-pagination-for-Zebra-and.patch (text/plain), 3.71 KB, created by
Séverine Queune
on 2018-10-06 09:21:32 UTC
(
hide
)
Description:
Bug 21405: Fix authorities pagination for Zebra and ES
Filename:
MIME Type:
Creator:
Séverine Queune
Created:
2018-10-06 09:21:32 UTC
Size:
3.71 KB
patch
obsolete
>From 38cf865b5f7256359c503cf4d53bd4875106cca2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 4 Oct 2018 13:09:56 +0000 >Subject: [PATCH] Bug 21405: Fix authorities pagination for Zebra and ES >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch corrects a problem introduced by bug 20261 > >The underlying problem still exists - the two search_auth_compat methods >don't expect the same information. Using the 'options' parameter allows >us to work around this for ES. > >Additionally code is added to avoid asking for more results form ES than >are returned. > >To test: > 1 - Perform an authorities search with 1+ pages using Zebra > 2 - Page through results, note you are only offseeting by 1 each time > 3 - Perform an authorities search with 10,000+ results in ES > 4 - Click on the last page and get an error > 5 - Apply patch > 6 - Retry Zebra search > 7 - Results should paginate correctly > 8 - Clicking on last page should return last results > 9 - Retry ES results >10 - Results should paginate correctly >11 - Clicking on last page hsould return last results > >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> >--- > Koha/SearchEngine/Elasticsearch/Search.pm | 4 +++- > authorities/authorities-home.pl | 17 +++++++++++------ > 2 files changed, 14 insertions(+), 7 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm >index 6340ebe..8bc147b 100644 >--- a/Koha/SearchEngine/Elasticsearch/Search.pm >+++ b/Koha/SearchEngine/Elasticsearch/Search.pm >@@ -187,7 +187,9 @@ results in a form the same as L<C4::AuthoritiesMarc::SearchAuthorities>. > sub search_auth_compat { > my $self = shift; > >- # TODO handle paging >+ # FIXME the options here should match zebra - we take page, but should take offset >+ # page is calculated to offset in search above, though we can pass offset directly too >+ # via options > my $database = Koha::Database->new(); > my $schema = $database->schema(); > my $res = $self->search(@_); >diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl >index 3f40072..a65eb5b 100755 >--- a/authorities/authorities-home.pl >+++ b/authorities/authorities-home.pl >@@ -23,6 +23,7 @@ use warnings; > use CGI qw ( -utf8 ); > use URI::Escape; > use C4::Auth; >+use POSIX qw(ceil); > > use C4::Context; > use C4::Auth; >@@ -95,8 +96,9 @@ if ( $op eq "do_search" ) { > [$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 >+ $search_query, $offset, $resultsperpage, ( offset => $offset - 1 ) > ); > > ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -180,15 +182,18 @@ if ( $op eq "do_search" ) { > > $template->param( result => $results ) if $results; > >+ my $max_result_window = $searcher->max_result_window; >+ my $hits_to_paginate = ($max_result_window && $max_result_window < $total) ? $max_result_window : $total; > $template->param( > pagination_bar => pagination_bar( >- $base_url, int( $total / $resultsperpage ) + 1, >+ $base_url, ceil( $hits_to_paginate / $resultsperpage ) , > $startfrom, 'startfrom' > ), >- total => $total, >- from => $from, >- to => $to, >- isEDITORS => $authtypecode eq 'EDITORS', >+ total => $total, >+ hits_to_paginate => $hits_to_paginate, >+ from => $from, >+ to => $to, >+ isEDITORS => $authtypecode eq 'EDITORS', > ); > > } >-- >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 21405
:
79948
|
80157
|
80158
|
80159
|
82824
|
82830
|
82838
|
82839
|
82960