Bug 22228 - Elasticsearch - standalone colons should be escaped when performing a search
Summary: Elasticsearch - standalone colons should be escaped when performing a search
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Ere Maijala
QA Contact: Josef Moravec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-29 16:30 UTC by Nick Clemens
Modified: 2020-01-06 20:15 UTC (History)
6 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 22228: Escape lone colons and make sure term is balanced (3.68 KB, patch)
2019-01-31 11:54 UTC, Ere Maijala
Details | Diff | Splinter Review
Bug 22228: Escape lone colons and make sure term is balanced (3.82 KB, patch)
2019-03-04 14:04 UTC, Björn Nylén
Details | Diff | Splinter Review
Bug 22228: Escape lone colons and make sure term is balanced (3.89 KB, patch)
2019-03-04 15:58 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2019-01-29 16:30:23 UTC
Currently if you search with a colon it can cause failure or no results

To recreate:
Search for a term containing a colon
i.e. Harry potter : the creature vault
Note search fails
Now try
Harry potter \: the creature vault
It works (maybe returns nothing)
Comment 1 Ere Maijala 2019-01-31 11:54:42 UTC
Created attachment 84568 [details] [review]
Bug 22228: Escape lone colons and make sure term is balanced

Escapes unquoted colons that have whitespace on either side. Removed unbalanced quotes.

Test plan:

1. Make sure the test case described in the bug works
2. Make sure tests pass:
  prove t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
Comment 2 Björn Nylén 2019-03-04 14:04:51 UTC
Created attachment 85993 [details] [review]
Bug 22228: Escape lone colons and make sure term is balanced

Escapes unquoted colons that have whitespace on either side. Removed unbalanced quotes.

Test plan:

1. Make sure the test case described in the bug works
2. Make sure tests pass:
  prove t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Björn Nylén <bjorn.nylen(at)ub.lu.se>
Comment 3 Josef Moravec 2019-03-04 15:58:02 UTC
Created attachment 86010 [details] [review]
Bug 22228: Escape lone colons and make sure term is balanced

Escapes unquoted colons that have whitespace on either side. Removed unbalanced quotes.

Test plan:

1. Make sure the test case described in the bug works
2. Make sure tests pass:
  prove t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Björn Nylén <bjorn.nylen(at)ub.lu.se>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 4 Nick Clemens 2019-03-04 18:49:55 UTC
Awesome work all!

Pushed to master for 19.05
Comment 5 Martin Renvoize 2019-03-05 15:09:13 UTC
Pushed to 18.11.x for 18.11.04
Comment 6 Lucas Gass 2019-03-13 16:13:56 UTC
not backporting this to the 18.05.x series