Bug 12478: authority paging works

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>
This commit is contained in:
Robin Sheat 2015-03-10 18:12:51 +13:00 committed by Brendan Gallagher
parent e00fadad67
commit b76d61a24b
2 changed files with 6 additions and 3 deletions

View 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;
}

View File

@ -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(