From c5f351360f2f5d3848f152c73685463808441574 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 5 Oct 2015 10:58:50 +0100 Subject: [PATCH] Bug 12478: (follow-up) Display the correct number of facets This patch fixes a side-effect of the previous "Display the correct number of facets (5 instead of 6)" patch. If you ask for more facets ('show more' link) and that the number of facets is > 5 but < 10, 1 facet will be missing. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm index 5e7753b82a..4f5a1376ab 100644 --- a/Koha/SearchEngine/Elasticsearch/Search.pm +++ b/Koha/SearchEngine/Elasticsearch/Search.pm @@ -416,7 +416,7 @@ sub _convert_facets { "type_label_$type_to_label{$type}" => 1, type_link_value => $type, }; - $limit = $#{ $data->{terms} } if ( $limit > @{ $data->{terms} } ); + $limit = @{ $data->{terms} } if ( $limit > @{ $data->{terms} } ); foreach my $term ( @{ $data->{terms} }[ 0 .. $limit - 1 ] ) { my $t = $term->{term}; my $c = $term->{count}; -- 2.39.5