Bugzilla – Attachment 121111 Details for
Bug 28371
Improve performance of XSLTParse4Display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28371: WIP
Bug-28371-WIP.patch (text/plain), 4.18 KB, created by
Nick Clemens (kidclamp)
on 2021-05-18 13:23:22 UTC
(
hide
)
Description:
Bug 28371: WIP
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-05-18 13:23:22 UTC
Size:
4.18 KB
patch
obsolete
>From 8a48be54d366f6722f2e249a3a2edc653485cb45 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 18 May 2021 13:20:07 +0000 >Subject: [PATCH] Bug 28371: WIP > >A lot of our time is spent in transformMARC4XSLT > >We do a db lookup per authval, every time - adding some caching here (probably in a better way) quickly increases performance > >Additionally, passing through the framework code can save us a lookup each time. >--- > C4/Search.pm | 2 +- > C4/XSLT.pm | 20 ++++++++++++++------ > 2 files changed, 15 insertions(+), 7 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 0db460a808..deadfd8a52 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -2019,7 +2019,7 @@ sub searchResults { > }); > > $record_processor->process($marcrecord); >- $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang, $xslt_variables); >+ $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang, $xslt_variables, $fw); > } > > # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 3cdf451b28..c16238addc 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -40,6 +40,7 @@ use vars qw(@ISA @EXPORT); > > my $engine; #XSLT Handler object > my %authval_per_framework; >+my %authval_descs; > # Cache for tagfield-tagsubfield to decode per framework. > # Should be preferably be placed in Koha-core... > >@@ -66,8 +67,8 @@ Is only used in this module currently. > =cut > > sub transformMARCXML4XSLT { >- my ($biblionumber, $record) = @_; >- my $frameworkcode = GetFrameworkCode($biblionumber) || ''; >+ my ($biblionumber, $record, $frameworkcode ) = @_; >+ $frameworkcode //= GetFrameworkCode($biblionumber) || ''; > my $tagslib = &GetMarcStructure(1, $frameworkcode, { unsafe => 1 }); > my @fields; > # FIXME: wish there was a better way to handle exceptions >@@ -85,8 +86,15 @@ sub transformMARCXML4XSLT { > my ( $letter, $value ) = @$subfield; > # Replace the field value with the authorised value *except* for MARC21/NORMARC field 942$n (suppression in opac) > if ( !( $tag eq '942' && $subfield->[0] eq 'n' ) || $marcflavour eq 'UNIMARC' ) { >- $value = GetAuthorisedValueDesc( $tag, $letter, $value, '', $tagslib ) >- if $av->{ $tag }->{ $letter }; >+ if( defined $authval_descs{$frameworkcode.$tag.$letter.$value} ){ >+ $value = $authval_descs{$frameworkcode.$tag.$letter.$value}; >+ } else { >+ if( $av->{$tag}->{$letter} ){ >+ my $orig_val = $value; >+ $value = GetAuthorisedValueDesc( $tag, $letter, $value, '', $tagslib ); >+ $authval_descs{$frameworkcode.$tag.$letter.$orig_val} = $value; >+ } >+ } > } > push( @new_subfields, $letter, $value ); > } >@@ -190,7 +198,7 @@ sub get_xslt_sysprefs { > } > > sub XSLTParse4Display { >- my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables ) = @_; >+ my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables, $frameworkcode ) = @_; > > $sysxml ||= C4::Context->preference($xslsyspref); > $xslfilename ||= C4::Context->preference($xslsyspref); >@@ -241,7 +249,7 @@ sub XSLTParse4Display { > } > > # grab the XML, run it through our stylesheet, push it out to the browser >- my $record = transformMARCXML4XSLT($biblionumber, $orig_record); >+ my $record = transformMARCXML4XSLT($biblionumber, $orig_record, $frameworkcode); > my $itemsxml; > if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) { > $itemsxml = ""; #We don't use XSLT for items display on these pages >-- >2.11.0
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 28371
:
121111
|
124086
|
124087
|
127082
|
127083
|
127090
|
127091
|
132801
|
132802
|
132943
|
132944
|
133719
|
133720
|
133872
|
135373
|
135381