Bug 28292

Summary: Searching with colon ":" in the end of query gives internal server error
Product: Koha Reporter: Joonas Kylmälä <joonas.kylmala>
Component: Searching - ElasticsearchAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P5 - low CC: bolshawh, dcook, lucy.vaux-harvey, nugged, stalkernoid
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24567
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28316
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 28292: strip the colon when it ends the query

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 ***