From 588889560583278fed3335e4459ffe9458390f7c Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Sat, 21 Aug 2021 11:40:58 +0300 Subject: [PATCH] Bug 28736: (QA follow-up) hints in explanation about broken syntax Add direct hint for the user what might be the issues with search phrase. In most cases we have unescaped or not removed special characters when user copy-pastes book name. If we explain that error happens because there is special search language, user will know what to research because we explicitly will tell that this is NOT the empty result, but search wasn't performed. --- Koha/SearchEngine/Elasticsearch.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 803f152487..4f24e9c4b4 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -1218,7 +1218,9 @@ sub process_error { warn $msg; # simple logging # This is super-primitive - return "Unable to understand your search query, please rephrase and try again.\n" if $msg =~ /ParseException|parse_exception/; + return "There might be results, but there is ElasticSearch query language syntax error in your request: ". + "remove or escape with backslash special ES characters like !:[]{}^ or create a proper ES-language request and try again.\n" + if $msg =~ /ParseException|parse_exception/; return "Unable to perform your search. Please try again.\n"; } -- 2.33.0