From ce5bc33ef3c1055373d7d047d44f10fa42eb2584 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 5 Oct 2015 11:34:54 +0100 Subject: [PATCH] Bug 12478: Remove empty limit parameter If no limit are passed, the url will contain '&limit=' anyway. It is not necessary and can be avoided easily Test plan: 1/ Search for a term in your catalogue 2/ Hover over a link in the facet area 3/ The link is cgi-bin/koha/opac-search.pl?idx=kw&q=your_term&limit=&limit=[...] With this patch, the empty limit parameter does not appear. 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/QueryBuilder.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 09d65a63b5..30bf6f8f73 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -223,8 +223,9 @@ sub build_query_compat { my $simple_query = $operands->[0] if @$operands == 1; my $query_desc = $simple_query; my $limit = $self->_join_queries( $self->_convert_index_strings(@$limits)); - my $limit_cgi = - '&limit=' . join( '&limit=', map { uri_escape_utf8($_) } @$orig_limits ); + my $limit_cgi = ( $orig_limits and @$orig_limits ) + ? '&limit=' . join( '&limit=', map { uri_escape_utf8($_) } @$orig_limits ) + : ''; my $limit_desc = "$limit" if $limit; return ( undef, $query, $simple_query, $query_cgi, $query_desc, -- 2.39.5