Bug 12478: Display the correct number of facets (5 instead of 6)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 28 Aug 2015 10:24:24 +0000 (11:24 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 26 Apr 2016 12:59:40 +0000 (09:59 -0300)
The loop on facet entries was wrong, it should stop after 5
iterations.

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 92561e1..1a74e95 100644 (file)
@@ -417,7 +417,7 @@ sub _convert_facets {
             "type_label_$type_to_label{$type}" => 1,
             type_link_value                    => $type,
         };
-        foreach my $term ( @{ $data->{terms} }[ 0 .. $limit ] ) {
+        foreach my $term ( @{ $data->{terms} }[ 0 .. $limit - 1 ] ) {
             my $t = $term->{term};
             my $c = $term->{count};
             if ( exists( $special{$type} ) ) {