Bug 19565 - Fix regular expression in _truncate_terms so field names are not split up
Summary: Fix regular expression in _truncate_terms so field names are not split up
Status: RESOLVED DUPLICATE of bug 19559
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: David Gustafsson
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-02 14:33 UTC by David Gustafsson
Modified: 2017-11-02 15:01 UTC (History)
0 users

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


Attachments
Bug 19565: Fix regular expression in _truncate_terms so field names are not split up (1.83 KB, patch)
2017-11-02 14:53 UTC, David Gustafsson
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Gustafsson 2017-11-02 14:33:52 UTC
The regular expression used for extraction search terms does not allow for field names containing "." or "-". For example Control-number.raw:"123", would be split up into: "Control-number." and "raw\"123\"". "Control-number:"123" into "Control-", "number:\"123\"". The regular expression needs to be adjusted to allow for certain valid characters ("." and "-" most importantly) in field names.
Comment 1 David Gustafsson 2017-11-02 14:53:23 UTC
Created attachment 68893 [details] [review]
Bug 19565: Fix regular expression in _truncate_terms so field names are not split up

The regular expression used for tokenizing search string does not allow for field names containing "." or "-". Fix regular expression to allow for field names containing "." or "-".

Test plan:
1. Make sure Elasticsearch is used as default search engine.
2. Select "Search the catalog" in the staff client front page.
3. Search for Control-number.raw="<control number>" where <control
number> is an existing control number. (The quotes around are value are needed to prevent
Koha from appending "*" to control number).
4. The search should not yield any results.
5. Apply patch.
6. Search again using the same condition.
7. The biblio with the control number used in the search should appear as a match.
8. Search for Control-number="<control number>".
9. The biblio with the control number used in the search should appear as a match.
Comment 2 David Gustafsson 2017-11-02 14:59:38 UTC
Just saw this bug was recently reported in: "https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19559", which also contains a test case. Would be nice if "." could also be included as a valid field name character though.
Comment 3 David Gustafsson 2017-11-02 15:01:25 UTC

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