From 149ce950e9526083fb7201c013a054f725b7a3e4 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 803f152487..a0045ff111 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -1218,7 +1218,10 @@ 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 search request: remove or ". + "escape with backslash ES-language reserved characters (those are: + - = && || > < ! ( ) { } [ ] ^ \" ~ * ? : \ / ) ". + "or change it to be the 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