From baf1dcb6260e272f25cf39b87a167a1d30519382 Mon Sep 17 00:00:00 2001 From: Lisette Scheer Date: Mon, 3 Feb 2025 16:19:11 +0000 Subject: [PATCH] Bug 39020: Search filters can't parse query 1. Turn on the SavedSearchFilters system preference 2. Go to advanced search, select a number of item types and search 3. Save the search 4. Enter a search term (such as power) 5. select the filter. Observe the following message: Error: Unable to understand your search query, please rephrase and try again. 6. Apply patch 7. Repeat steps 4 & 5, search should work as expected. 8. Sign off! Signed-off-by: Roman Dolny Signed-off-by: Jonathan Druart --- Koha/SearchFilter.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/SearchFilter.pm b/Koha/SearchFilter.pm index ae9fd53b84f..763a2fa8982 100644 --- a/Koha/SearchFilter.pm +++ b/Koha/SearchFilter.pm @@ -51,7 +51,7 @@ sub expand_filter { my $operands = $query->{operands}; my $indexes = $query->{indexes}; - my $query_limit = "("; + my $query_limit = ""; for ( my $i = 0 ; $i < scalar @$operands ; $i++ ) { next unless @$operands[$i]; my $index = @$indexes[$i] ? @$indexes[$i] . "=" : ""; @@ -62,7 +62,7 @@ sub expand_filter { my $limit = $operator . $index . $query; $query_limit .= $limit; } - $query_limit .= ")"; + $query_limit = "(" . $query_limit . ")" if $query_limit; return ( $limits, $query_limit ); } -- 2.39.5