[Koha-bugs] [Bug 28736] Better error message when ES fails to understand the syntax of the search query

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Aug 21 10:56:21 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28736

Andrew Nugged <nugged at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #123985|0                           |1
        is obsolete|                            |

--- Comment #5 from Andrew Nugged <nugged at gmail.com> ---
Created attachment 124005
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=124005&action=edit
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 at davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor at tuxayo.net>
Signed-off-by: Andrew Nugged <nugged at gmail.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list