From 5a3830d7963bed1d4fdaea8f4036f2a4d48cfa87 Mon Sep 17 00:00:00 2001 From: Petro Vashchuk Date: Tue, 13 Jul 2021 12:13:03 +0300 Subject: [PATCH] Bug 28316: escape brackets in the search query This patch screens square and curly brackets which have no special language meaning. To reproduce: 1) using ES, search for the book with title that contains square and/or curly brackets, like "book [second edition]", which will result in error. 2) apply the patch. 3) search for that book again, ensure that it works now. Signed-off-by: Victor Grousset/tuxayo --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 6346656ddb..1ba74fcb18 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -930,7 +930,6 @@ sub _clean_search_term { $term =~ s/=/:/g; $term = $self->_convert_index_strings_freeform($term); - $term =~ s/[{}]/"/g; # Remove unbalanced quotes my $unquoted = $term; @@ -952,6 +951,8 @@ sub _clean_search_term { # and correctly ignore unevenly backslashed: $term =~ s/((?