Bug 12478: authority paging works
authorRobin Sheat <robin@catalyst.net.nz>
Tue, 10 Mar 2015 05:12:51 +0000 (18:12 +1300)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Tue, 26 Apr 2016 20:20:05 +0000 (20:20 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Koha/SearchEngine/Elasticsearch/Search.pm
opac/opac-authorities-home.pl

index dd84cd7..a745c5e 100644 (file)
@@ -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;
 }
index d22a53d..e90e349 100755 (executable)
@@ -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(