Bugzilla – Attachment 150138 Details for
Bug 33206
Bad title__sort made of multisubfield 245
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33206: Bad title__sort made of multifield 245
Bug-33206-Bad-titlesort-made-of-multifield-245.patch (text/plain), 4.16 KB, created by
Katrin Fischer
on 2023-04-23 21:40:54 UTC
(
hide
)
Description:
Bug 33206: Bad title__sort made of multifield 245
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-04-23 21:40:54 UTC
Size:
4.16 KB
patch
obsolete
>From b872463dee3b6434d96300f826df0a53e1b43d43 Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Sat, 11 Mar 2023 17:03:10 +0100 >Subject: [PATCH] Bug 33206: Bad title__sort made of multifield 245 > >In MARC 21, having title search field defined in mappings.yaml as 245abp >(more than one subfield), the Koha generated title__sort will have not >only $a, but also other subfields cut by ind2 characters, i.e.: > >245 04 $a Die Renaissance : $b Architektur, Plastik, Malerei, Illustrationen, Zeichnungen > >becomes as title__sort: > >Renaissance : itektur, Plastik, Malerei, Illustrationen, Zeichnungen > >instead of: > >Renaissance : Architektur, Plastik, Malerei, Illustrationen, Zeichnungen > >This is because copying an array of pointers in Perl causes you to >point to the same (anonymous) element. Therefore, the intended >modification only for subfield "a" >(Koha/SearchEngine/Elasticsearch.pm, ~line 1157) causes in fact >modification for all the subfields sharing the same mapping >definition and introduction of the nonfiling_characters_indicator to >all subfields 245 when processing 245abp. And this is obviously not >what is intended and results (in some cases) with bad sort order >when sorting by titles. > >Test plan >========= >1. Have a standard Koha ES installation. In mappings.yaml > you should have 245abp for title search field. > >2. Insert / download / modify a record with 245 $b or $p, > an article at the beginning of the title, and correctly > set 2nd indicator. For instance: > >245 04 $a Die Renaissance : $b Architektur, Plastik, Malerei, Illustrationen, Zeichnungen > >3. In ES, with Kibana or culr, control the content of > title__sort field for the related document. It will be: > >Renaissance : itektur, Plastik, Malerei, Illustrationen, Zeichnungen > >4. Apply the patch, full reindex ES (--rebuild -r -d -a -b) > >5. In ES, with Kibana or culr, control the content of > title__sort field for the related document. It should > be now correct, i.e.: > >Renaissance : Architektur, Plastik, Malerei, Illustrationen, Zeichnungen > >Signed-off-by: Nick <nick@bywatersolutions.com> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/SearchEngine/Elasticsearch.pm | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 9463aed1d3..a46f80c5c7 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -1112,24 +1112,24 @@ sub _get_marc_mapping_rules { > my @mappings = $self->_field_mappings($facet, $suggestible, $sort, $search, $name, $type, $range); > if ($field_tag < 10) { > $rules->{control_fields}->{$field_tag} //= []; >- push @{$rules->{control_fields}->{$field_tag}}, @mappings; >+ push @{$rules->{control_fields}->{$field_tag}}, @{clone(\@mappings)}; > } > else { > $rules->{data_fields}->{$field_tag} //= {}; > foreach my $subfield (@subfields) { > $rules->{data_fields}->{$field_tag}->{subfields}->{$subfield} //= []; >- push @{$rules->{data_fields}->{$field_tag}->{subfields}->{$subfield}}, @mappings; >+ push @{$rules->{data_fields}->{$field_tag}->{subfields}->{$subfield}}, @{clone(\@mappings)}; > } > foreach my $subfield_group (@subfield_groups) { > $rules->{data_fields}->{$field_tag}->{subfields_join}->{$subfield_group} //= []; >- push @{$rules->{data_fields}->{$field_tag}->{subfields_join}->{$subfield_group}}, @mappings; >+ push @{$rules->{data_fields}->{$field_tag}->{subfields_join}->{$subfield_group}}, @{clone(\@mappings)}; > } > } > } > elsif ($marc_field =~ $leader_regexp) { > my $range = defined $1 ? $1 : undef; > my @mappings = $self->_field_mappings($facet, $suggestible, $sort, $search, $name, $type, $range); >- push @{$rules->{leader}}, @mappings; >+ push @{$rules->{leader}}, @{clone(\@mappings)}; > } > else { > Koha::Exceptions::Elasticsearch::MARCFieldExprParseError->throw( >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33206
:
148103
|
149772
|
149773
| 150138 |
150139