Bugzilla – Attachment 73778 Details for
Bug 14769
Authorities merge: Set correct indicators in biblio field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14769: (Follow-up) Reduce number of preference parses
Bug-14769-Follow-up-Reduce-number-of-preference-pa.patch (text/plain), 2.88 KB, created by
Nick Clemens (kidclamp)
on 2018-04-06 13:06:06 UTC
(
hide
)
Description:
Bug 14769: (Follow-up) Reduce number of preference parses
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-04-06 13:06:06 UTC
Size:
2.88 KB
patch
obsolete
>From a37152217af29c5d4702b799793f684941e155ac Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 9 Feb 2018 09:03:26 +0100 >Subject: [PATCH] Bug 14769: (Follow-up) Reduce number of preference parses > >In sub merge the Koha::Authority object was already created, so it was kind >of silly to recreate it each time with new. >In Koha::Authority, the ControlledIndicators object can be saved in the >object too for reuse during its life time. Similarly, we prevent repeated >lookups for the reporting tag (via authority type). > >Test plan: >[1] Run t/db_dependent/Authority/Merge.t >[2] Run t/db_dependent/Koha/Authorities.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Limited benchmarking shows me a reduction of 11% on Merge.t and a >reduction of 4% on Authorities.t when comparing with and without this >last patch. The larger impact on Merge.t could be expected. > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/AuthoritiesMarc.pm | 2 +- > Koha/Authority.pm | 12 ++++++++---- > 2 files changed, 9 insertions(+), 5 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index f441c60..293f64b 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1471,7 +1471,7 @@ sub merge { > my $newtag = $tags_new && @$tags_new > ? _merge_newtag( $tag, $tags_new ) > : $tag; >- my $controlled_ind = Koha::Authority->new({ authtypecode => $authtypeto ? $authtypeto->authtypecode : undef })->controlled_indicators({ record => $MARCto, biblio_tag => $newtag }); #FIXME Replace this tric with new when refactoring >+ my $controlled_ind = $authto->controlled_indicators({ record => $MARCto, biblio_tag => $newtag }); > my $field_to = MARC::Field->new( > $newtag, > $controlled_ind->{ind1} // $field->indicator(1), >diff --git a/Koha/Authority.pm b/Koha/Authority.pm >index b427d7f..b4cf946 100644 >--- a/Koha/Authority.pm >+++ b/Koha/Authority.pm >@@ -99,12 +99,16 @@ sub controlled_indicators { > $self->marcxml, 'UTF-8', $flavour ); > } > >- my $authtype = Koha::Authority::Types->find( $self->authtypecode ); >- return {} if !$authtype; >+ if( !$self->{_report_tag} ) { >+ my $authtype = Koha::Authority::Types->find( $self->authtypecode ); >+ return {} if !$authtype; # very exceptional >+ $self->{_report_tag} = $authtype->auth_tag_to_report; >+ } > >- return Koha::Authority::ControlledIndicators->new->get({ >+ $self->{_ControlledInds} //= Koha::Authority::ControlledIndicators->new; >+ return $self->{_ControlledInds}->get({ > auth_record => $record, >- report_tag => $authtype->auth_tag_to_report, >+ report_tag => $self->{_report_tag}, > biblio_tag => $tag, > flavour => $flavour, > }); >-- >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 14769
:
42197
|
69343
|
70948
|
70949
|
70950
|
70951
|
71338
|
71339
|
71340
|
71341
|
71342
|
71343
|
71351
|
71352
|
71353
|
71354
|
71355
|
71366
|
71374
|
71375
|
71376
|
71377
|
71378
|
71379
|
71380
|
71381
|
72398
|
72399
|
72400
|
72401
|
72402
|
72403
|
72404
|
73389
|
73773
|
73774
|
73775
|
73776
|
73777
| 73778 |
73779
|
74052