From c0db8ec3a69844eb798ddd79798fdbd0794db5fe 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 --- Koha/SearchFilter.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/SearchFilter.pm b/Koha/SearchFilter.pm index 9694c1e31c..a76fb0fd31 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] . "=" : ""; @@ -61,7 +61,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