Bug 19684 - Colon char in MARC data breaks facets
Summary: Colon char in MARC data breaks facets
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Eden
QA Contact: Testopia
URL:
Keywords: Academy
Depends on:
Blocks:
 
Reported: 2017-11-23 10:24 UTC by Fridolin Somers
Modified: 2022-08-24 23:27 UTC (History)
9 users (show)

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


Attachments
Bug 19684: Only replace first colon char in facets link (1.29 KB, patch)
2017-11-23 10:37 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 19684: Only replace first colon char in facets link (1.36 KB, patch)
2018-03-15 13:13 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2017-11-23 10:24:25 UTC
When a MARC data used in some facet contains colon char ":", this facet is broken it leads to no result.
This is because all colon are replaced by = which is a CCL syntax char
Comment 1 Fridolin Somers 2017-11-23 10:37:02 UTC
Created attachment 69301 [details] [review]
Bug 19684: Only replace first colon char in facets link

When a MARC data used in some facet contains colon char ":", this facet is broken it leads to no result.
This is because all colon are replaced by = which is a CCL syntax char.

This patch corrects by replacing only first occurence of colon char, that is the index not the data.

Test plan :
1) Create a record with subject "Ainur: Yavanna" (650$a for MARC21 or 600$a for UNIMARC)
2) Index this record in Zebra
3) Perform a search that shows this subject in facets
4) Click on this facet link
5) You get the record as result
Comment 2 Jonathan Druart 2017-12-01 12:46:07 UTC
I am not sure I understand the changes, how can we know it will not introduce side-effects?
Tests are missing.
Comment 3 Fridolin Somers 2018-01-09 13:47:45 UTC
(In reply to Jonathan Druart from comment #2)
> I am not sure I understand the changes, how can we know it will not
> introduce side-effects?
> Tests are missing.

The facets links are composed of an index and a value separated by ":", for example su:History.
But real CCL syntax is index=value so ":" must be replaced by "=".
But actual code replaces all ":" even in value.
Comment 4 abernaud 2018-03-15 10:04:21 UTC
Test successful.
Comment 5 Biblibre Sandboxes 2018-03-15 13:12:11 UTC
Patch tested with a sandbox, by Anne-Claire Bernaudin <anne-claire.bernaudin@univ-rennes1.fr>
Comment 6 Biblibre Sandboxes 2018-03-15 13:13:07 UTC
Created attachment 72947 [details] [review]
Bug 19684: Only replace first colon char in facets link

When a MARC data used in some facet contains colon char ":", this facet is broken it leads to no result.
This is because all colon are replaced by = which is a CCL syntax char.

This patch corrects by replacing only first occurence of colon char, that is the index not the data.

Test plan :
1) Create a record with subject "Ainur: Yavanna" (650$a for MARC21 or 600$a for UNIMARC)
2) Index this record in Zebra
3) Perform a search that shows this subject in facets
4) Click on this facet link
5) You get the record as result

Signed-off-by: Anne-Claire Bernaudin <anne-claire.bernaudin@univ-rennes1.fr>
Comment 7 Nick Clemens 2018-03-23 16:19:34 UTC
Unit tests needed
Comment 8 Fridolin Somers 2021-06-21 15:02:54 UTC
Still valid ?
Comment 9 Fridolin Somers 2022-08-24 21:07:34 UTC
Arf limit may contain serveral blocks.

Maybe we should move this replacement in :

foreach my $this_limit (@limits) {