From b76d61a24b40f063126aedee60fc65e361cdf802 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Tue, 10 Mar 2015 18:12:51 +1300 Subject: [PATCH] Bug 12478: authority paging works Signed-off-by: Nick Clemens Signed-off-by: Jesse Weaver Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Brendan Gallagher --- Koha/SearchEngine/Elasticsearch/Search.pm | 7 ++++--- opac/opac-authorities-home.pl | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm index dd84cd754a..a745c5e4ec 100644 --- a/Koha/SearchEngine/Elasticsearch/Search.pm +++ b/Koha/SearchEngine/Elasticsearch/Search.pm @@ -103,13 +103,14 @@ faster than pulling all the data in, ususally. =cut sub count { - my ($self, $query) = @_; + my ( $self, $query ) = @_; my $params = $self->get_elasticsearch_params(); $self->store( Catmandu::Store::ElasticSearch->new( %$params, trace_calls => 1, ) ); -# TODO something like this should work, but doesn't seem to just yet. -# my $count = $self->store->bag->count($query); + + # TODO something like this should work, but doesn't seem to just yet. + # my $count = $self->store->bag->count($query); my $count = $self->store->bag->search(%$query)->total; return $count; } diff --git a/opac/opac-authorities-home.pl b/opac/opac-authorities-home.pl index d22a53d8c7..e90e34988c 100755 --- a/opac/opac-authorities-home.pl +++ b/opac/opac-authorities-home.pl @@ -67,6 +67,8 @@ if ( $op eq "do_search" ) { # use Data::Dumper; # die Dumper(\@marclist, \@and_or, # \@excluding, \@operator, \@value, $authtypecode, $orderby, $query); + # The searchengine API expects pages to start at page 1 + $startfrom = defined($startfrom) ? $startfrom+1 : undef; my ( $results, $total ) = $searcher->search_auth_compat( $search_query, $startfrom, $resultsperpage ); ( $template, $loggedinuser, $cookie ) = get_template_and_user( -- 2.39.5