From 1c3c821715345e3ff51ac9ba442e07e9b2b05ce6 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 30 Oct 2025 16:35:59 +0100 Subject: [PATCH] Bug 41141: Fix linker with Elasticsearch fails when heading contains parenthesis or equal sign With Elasticsearch, authorities linker fails when heading contains parenthesis or equal sign. Looks like those characters are removed because of CCL syntax but Elasticsearch in this context uses 'ci_raw' form that does not matches if characters are removed. So we should do it only with Zebra. Test plan : 1 - Use Elasticsearch 2 - Set sysprefs: RequireChoosingExistingAuthority - don't require AutoCreateAuthorities - generate CatalogModuleRelink - Do AutoLinkBiblio - Do LinkerModule - first match 3 - Find a biblio record with an author attached to an authority 4 - Edit this authority record and add to heading a text with parenthesis, ie '(junior)' 5 - Edit the biblio record in advanced editor 6 - Delete the $9 link 7 - Save the record 8 - It generates a new authority record 10 - Apply patch and restart all 11 - Repeat 4-5 12 - It links to the original authority --- C4/Heading/MARC21.pm | 7 +++++-- C4/Heading/UNIMARC.pm | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/C4/Heading/MARC21.pm b/C4/Heading/MARC21.pm index fc7fad7b9c..b34ceead94 100644 --- a/C4/Heading/MARC21.pm +++ b/C4/Heading/MARC21.pm @@ -413,8 +413,11 @@ sub _get_search_heading { } } - # remove characters that are part of CCL syntax - $heading =~ s/[)(=]//g; + if ( C4::Context->preference('SearchEngine') eq 'Zebra' ) { + + # remove characters that are part of CCL syntax + $heading =~ s/[)(=]//g; + } return $heading; } diff --git a/C4/Heading/UNIMARC.pm b/C4/Heading/UNIMARC.pm index 7c2969dce9..9efc5c6674 100644 --- a/C4/Heading/UNIMARC.pm +++ b/C4/Heading/UNIMARC.pm @@ -172,8 +172,11 @@ sub _get_search_heading { } } - # remove characters that are part of CCL syntax - $heading =~ s/[)(=]//g; + if ( C4::Context->preference('SearchEngine') eq 'Zebra' ) { + + # remove characters that are part of CCL syntax + $heading =~ s/[)(=]//g; + } return $heading; } -- 2.43.0