From fa39f9a65efc15a7b6bcd4d0f4629294ab962060 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 Signed-off-by: Alex Buckley Signed-off-by: Martin Renvoize Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- 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 6cb4fe0d8e..4621199c53 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/((?