Bug 28316: screen unquoted semicolons and all followup colons
authorPetro Vashchuk <stalkernoid@gmail.com>
Fri, 18 Jun 2021 07:43:14 +0000 (10:43 +0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 1 Oct 2021 18:15:27 +0000 (14:15 -0400)
commit5b4b14e493fef9f8f84060b6b5d83fbdcccfc65e
tree406179afebf2ec9aaeb7d1b9accc8db6b378ebaa
parent405812b407f77de2d60c8f4534728399068789d8
Bug 28316: screen unquoted semicolons and all followup colons

Currently searches like: "book:", ":book" and "host-item:test:n"
cause internal server errors.

This patch adds additional regexes that remove the colons at the start
and end of the query, and another regex that screens all follow-up
colons that go after the first colon to avoid errors when searching for
"host-item:test:n".

To reproduce:
1) using ES, search for the book with title that contains
semicolon at the start or at the end of the line, separated with spaces,
this should cause internal server error.
2) try doing the same with something like "host-item:test:n", it should
result in error as well.
3) apply the patch.
4) repeat steps 1-2, ensure that it works now.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm