Bug 28292 - Searching with colon ":" in the end of query gives internal server error
Summary: Searching with colon ":" in the end of query gives internal server error
Status: RESOLVED DUPLICATE of bug 28316
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-06 09:45 UTC by Joonas Kylmälä
Modified: 2021-06-11 09:29 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 28292: strip the colon when it ends the query (2.50 KB, patch)
2021-05-21 12:07 UTC, Peter Vashchuk
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Kylmälä 2021-05-06 09:45:12 UTC
Searching (SearchEngine=elasticsearch) the catalogue with anything that ends with just a colon ":" gives internal server error. E.g. searching "hello:" gives this error. The code that was modified in bug 24567 would need to be adapted so that it would strip also the colon when it ends the query and not just when there is whitespace around it.
Comment 1 Peter Vashchuk 2021-05-21 12:07:46 UTC
Created attachment 121273 [details] [review]
Bug 28292: strip the colon when it ends the query

This patch adds additional regexp that strips the colon when it ends
the query to avoid the internal server error. Also this patch adds new
tests that check if colon gets removed from the very beginning and
the very end of the query.

To reproduce:
1) Enable ES and try to search "test:", which should give the internal server error.
2) Apply the patch, perform the same search again. Make sure that it doesn't gives that same error.
3) Additionally run t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t test and ensure that all tests are successful.
Comment 2 Joonas Kylmälä 2021-06-03 12:41:54 UTC
Searching with "host-item:spr:n" even with this patch gives still error
Comment 3 Peter Vashchuk 2021-06-11 09:29:35 UTC

*** This bug has been marked as a duplicate of bug 28316 ***