Bug 19684

Summary: Colon char in MARC data breaks facets
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: SearchingAssignee: Eden <eden.bacani>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: anne-claire.bernaudin, dcook, eden.bacani, ellawipatene, jonathan.druart, martin.renvoize, nick, sandboxes
Version: MainKeywords: Academy
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27575
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29418
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 19684: Only replace first colon char in facets link
Bug 19684: Only replace first colon char in facets link

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 (kidclamp) 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) {