Bugzilla – Attachment 124005 Details for
Bug 28736
Better error message when ES fails to understand the syntax of the search query
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28736: fix requirements for the correct error message to show up
Bug-28736-fix-requirements-for-the-correct-error-m.patch (text/plain), 2.42 KB, created by
Andrii Nugged
on 2021-08-21 08:56:21 UTC
(
hide
)
Description:
Bug 28736: fix requirements for the correct error message to show up
Filename:
MIME Type:
Creator:
Andrii Nugged
Created:
2021-08-21 08:56:21 UTC
Size:
2.42 KB
patch
obsolete
>From aaafee174073bbc78189e7e7539236dc677470f0 Mon Sep 17 00:00:00 2001 >From: Petro Vashchuk <stalkernoid@gmail.com> >Date: Mon, 26 Jul 2021 12:27:40 +0300 >Subject: [PATCH] Bug 28736: fix requirements for the correct error message to > show up > >There is existing error message in the code stating: >"Unable to understand your search query, please rephrase and try again." >which fits perfectly but because it looks for "ParseException" in the >warning output it doesn't show up on this page as it's actually >"parse_exception". > >This patch makes that it's also checked if "parse_exception" is present >in the warning output. > >Side note: >"ParseException" reaction code was added here: > e0f6c4dc Bug 12478: improve error reporting a bit >Search::Elasticsearch seems propagates clean ES JSON answer, >and in current ES version inside of $@ it contains "parse_exception" >string in dumped JSON answer ("'type' => 'parse_exception'"). >Old seeked phrase "ParseException" wasn't reproduced, only in ES logs >("Caused by: org.apache.lucene.queryparser.classic.ParseException: > Cannot parse ..."). Check for both phrases won't complicate future >changes, but this note added for reference and code cleanup if needed. > >To reproduce: >1) using ES search for something like "// ^ ! { } [ ] .. , <>" that >will for sure break the syntax of ES. >2) after the search query fails note that the error is >"Unable to perform your search. Please try again." >3) apply the patch >4) search for the same thing again >5) error message should be "Unable to understand your search query, >please rephrase and try again." now. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: Andrew Nugged <nugged@gmail.com> >--- > Koha/SearchEngine/Elasticsearch.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 8950f8fb9e..803f152487 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -1218,7 +1218,7 @@ 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/; >+ return "Unable to understand your search query, please rephrase and try again.\n" if $msg =~ /ParseException|parse_exception/; > > return "Unable to perform your search. Please try again.\n"; > } >-- >2.33.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28736
:
123046
|
123181
|
123404
|
123985
| 124005 |
124006
|
124007
|
124008