Bugzilla – Attachment 71777 Details for
Bug 19279
Performance of linked items in search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19279 - performance of linked items in search
Bug-19279---performance-of-linked-items-in-search.patch (text/plain), 2.54 KB, created by
Kyle M Hall (khall)
on 2018-02-16 14:18:25 UTC
(
hide
)
Description:
Bug 19279 - performance of linked items in search
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-02-16 14:18:25 UTC
Size:
2.54 KB
patch
obsolete
>From 3c10f58f82d19d309767cf25bf8cc4c4e9cae0c9 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 8 Sep 2017 17:20:38 +0200 >Subject: [PATCH] Bug 19279 - performance of linked items in search > >When catalog has fields 773 (461 in UNIMARC), those linked items are fetched for display in search results. >Look like the code could be more performant by replacing item search >by $9 with direct call with GetMarcItem(). > >Test plan : >- Get a record A with a lot of items >- Create a new record B >- Create a linked items from B to A with a field 773 (461 in UNIMARC) : biblionumber in $0 and itemnumber in $9 >- Display B record details >=> Compare execution times with and without patch > >Signed-off-by: Hugo Agud <hagud@orex.es> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Search.pm | 22 +++++++--------------- > 1 file changed, 7 insertions(+), 15 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index c11a61e..743e31c 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -2006,21 +2006,13 @@ sub searchResults { > } > foreach my $hostfield ( $marcrecord->field($analyticsfield)) { > my $hostbiblionumber = $hostfield->subfield("0"); >- my $linkeditemnumber = $hostfield->subfield("9"); >- if(!$hostbiblionumber eq undef){ >- my $hostbiblio = GetMarcBiblio({ >- biblionumber => $hostbiblionumber, >- embed_items => 1 }); >- my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); >- if(!$hostbiblio eq undef){ >- my @hostitems = $hostbiblio->field($itemfield); >- foreach my $hostitem (@hostitems){ >- if ($hostitem->subfield("9") eq $linkeditemnumber){ >- my $linkeditem =$hostitem; >- # append linked items if they exist >- if (!$linkeditem eq undef){ >- push (@fields, $linkeditem);} >- } >+ if ($hostbiblionumber) { >+ my $linkeditemnumber = $hostfield->subfield("9"); >+ my $linkeditemmarc = C4::Items::GetMarcItem( $hostbiblionumber, $linkeditemnumber ); >+ if ($linkeditemmarc) { >+ my $linkeditemfield = $linkeditemmarc->field($itemtag); >+ if ($linkeditemfield) { >+ push( @fields, $linkeditemfield ); > } > } > } >-- >2.10.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 19279
:
67036
|
71083
|
71777
|
77204
|
92869
|
95455
|
100330
|
100952