Bug 12478: Do not display the 'Show more' links if no more facet available
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 28 Aug 2015 10:29:23 +0000 (11:29 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 26 Apr 2016 12:59:43 +0000 (09:59 -0300)
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>

Koha/SearchEngine/Elasticsearch/Search.pm

index 1a74e95..5e7753b 100644 (file)
@@ -408,7 +408,6 @@ sub _convert_facets {
 
         # We restrict to the most popular $limit results
         my $limit = ( $type eq $exp_facet ) ? 10 : 5;
-        $limit = $#{ $data->{terms} } if ( $limit > @{ $data->{terms} } );
         my $facet = {
             type_id    => $type . '_id',
             expand     => $type,
@@ -417,6 +416,7 @@ sub _convert_facets {
             "type_label_$type_to_label{$type}" => 1,
             type_link_value                    => $type,
         };
+        $limit = $#{ $data->{terms} } if ( $limit > @{ $data->{terms} } );
         foreach my $term ( @{ $data->{terms} }[ 0 .. $limit - 1 ] ) {
             my $t = $term->{term};
             my $c = $term->{count};