Bugzilla – Attachment 57621 Details for
Bug 17377
ES - control fields are not taken into account
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 17377: ES - Take control fields into account
PASSED-QA-Bug-17377-ES---Take-control-fields-into-.patch (text/plain), 2.58 KB, created by
Martin Renvoize (ashimema)
on 2016-11-18 09:07:13 UTC
(
hide
)
Description:
[PASSED QA] Bug 17377: ES - Take control fields into account
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2016-11-18 09:07:13 UTC
Size:
2.58 KB
patch
obsolete
>From 1aa450a54764ed34806e2bfd81eb95c68bae7497 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 29 Sep 2016 16:08:36 +0100 >Subject: [PATCH] [PASSED QA] Bug 17377: ES - Take control fields into account > >There is a bug in Koha::SearchEngine::Elasticsearc::Search->json2marc, it >assumes that the MARC::Field constructor always takes >= 5 parameters. >This assumption is wrong for control fields, to create a control field you >need to call the constructor with: > MARC::Field->new($tag, $value); > >Note that I got "Too much data for control field" in the _warning value of my >MARC::Field because too many parameters were passed, and the value was undef. > >That broke the result search links (on the staff interface) for DB with >biblio.biblionumber mapped with 001. > >Other bugs will certainly be fixed by this patch. >For instance I got: > GetMarcBiblio called with undefined biblionumber at /home/koha/src/opac/opac-search.pl line 664. > GetCOinSBiblio called with undefined record at /home/koha/src/opac/opac-search.pl line 665. >in my logs, with this patch I don't get them anymore. > >Test plan: >You can try to recreate the different issues and confirm than this patch >fixes them. >Or just run the tests > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/SearchEngine/Elasticsearch/Search.pm | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm >index 212a561..d1ccd52 100644 >--- a/Koha/SearchEngine/Elasticsearch/Search.pm >+++ b/Koha/SearchEngine/Elasticsearch/Search.pm >@@ -358,14 +358,22 @@ sub json2marc { > > # fields are like: > # [ '245', '1', '2', 'a' => 'Title', 'b' => 'Subtitle' ] >+ # or >+ # [ '001', undef, undef, '_', 'a value' ] > # conveniently, this is the form that MARC::Field->new() likes > foreach my $field (@$marcjson) { >- next if @$field < 5; # Shouldn't be possible, but... >+ next if @$field < 5; > if ( $field->[0] eq 'LDR' ) { > $marc->leader( $field->[4] ); > } > else { >- my $marc_field = MARC::Field->new(@$field); >+ my $tag = $field->[0]; >+ my $marc_field; >+ if ( MARC::Field->is_controlfield_tag( $field->[0] ) ) { >+ $marc_field = MARC::Field->new($field->[0], $field->[4]); >+ } else { >+ $marc_field = MARC::Field->new(@$field); >+ } > $marc->append_fields($marc_field); > } > } >-- >2.1.4
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 17377
:
55932
|
55933
|
55954
|
55955
|
57620
| 57621