Bugzilla – Attachment 111463 Details for
Bug 26641
link_bibs_to_authorities.pl: Add the ability to specify the MARC field to operate on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26641: Optimize CatalogModuleRelink lookup
Bug-26641-Optimize-CatalogModuleRelink-lookup.patch (text/plain), 3.29 KB, created by
David Cook
on 2020-10-11 23:58:22 UTC
(
hide
)
Description:
Bug 26641: Optimize CatalogModuleRelink lookup
Filename:
MIME Type:
Creator:
David Cook
Created:
2020-10-11 23:58:22 UTC
Size:
3.29 KB
patch
obsolete
>From d1ddefb91f646fbdc6a1d8684a780b109c63740a Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Sun, 11 Oct 2020 23:47:45 +0000 >Subject: [PATCH] Bug 26641: Optimize CatalogModuleRelink lookup > >This patch moves the CatalogModuleRelink lookup outside the loop to >improve performance (especially for large databases), and includes a >tester friendly test plan. > >Test plan: >0. Using koha-testing-docker >1. koha-shell -c "./misc/link_bibs_to_authorities.pl -l --test" kohadev >2. Note 436 bibs checked, 1315 headings linked, 676 headings unlinked >3. koha-shell -c "./misc/link_bibs_to_authorities.pl -l --test -g 700" kohadev >4. Note 436 bibs checked, 248 headings linked, 111 headings unlinked >5. Note output appear to all be names (rather than subjects or other authorities) >6. Note also that the 2nd run with -g 700 is almost 2x faster than without >--- > misc/link_bibs_to_authorities.pl | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > >diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl >index 41a9edb63f..e7df4d57f6 100755 >--- a/misc/link_bibs_to_authorities.pl >+++ b/misc/link_bibs_to_authorities.pl >@@ -37,6 +37,7 @@ my $auth_limit; > my $bib_limit; > my $commit = 100; > my $tagtolink; >+my $allowrelink = C4::Context->preference("CatalogModuleRelink") || ''; > > my $result = GetOptions( > 'v|verbose' => \$verbose, >@@ -79,13 +80,15 @@ my %linked_headings; > my %fuzzy_headings; > my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; >-process_bibs( $linker, $bib_limit, $auth_limit, $commit, $tagtolink ); >+process_bibs( $linker, $bib_limit, $auth_limit, $commit, { tagtolink => $tagtolink, allowrelink => $allowrelink }); > $dbh->commit(); > > exit 0; > > sub process_bibs { >- my ( $linker, $bib_limit, $auth_limit, $commit, $tagtolink ) = @_; >+ my ( $linker, $bib_limit, $auth_limit, $commit, $args ) = @_; >+ my $tagtolink = $args->{tagtolink}; >+ my $allowrelink = $args->{allowrelink}; > my $bib_where = ''; > my $starttime = time(); > if ($bib_limit) { >@@ -95,9 +98,10 @@ sub process_bibs { > "SELECT biblionumber FROM biblio $bib_where ORDER BY biblionumber ASC"; > my $sth = $dbh->prepare($sql); > $sth->execute(); >+ my $linker_args = { tagtolink => $tagtolink, allowrelink => $allowrelink }; > while ( my ($biblionumber) = $sth->fetchrow_array() ) { > $num_bibs_processed++; >- process_bib( $linker, $biblionumber, $tagtolink ); >+ process_bib( $linker, $biblionumber, $linker_args ); > > if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) { > print_progress_and_commit($num_bibs_processed); >@@ -189,8 +193,9 @@ _FUZZY_HEADER_ > sub process_bib { > my $linker = shift; > my $biblionumber = shift; >- my $tagtolink = shift; >- >+ my $args = shift; >+ my $tagtolink = $args->{tagtolink}; >+ my $allowrelink = $args->{allowrelink}; > my $bib = GetMarcBiblio({ biblionumber => $biblionumber }); > unless ( defined $bib ) { > print >@@ -200,7 +205,6 @@ sub process_bib { > } > > my $frameworkcode = GetFrameworkCode($biblionumber); >- my $allowrelink = C4::Context->preference("CatalogModuleRelink") || ''; > > my ( $headings_changed, $results ) = > LinkBibHeadingsToAuthorities( $linker, $bib, $frameworkcode, $allowrelink, $tagtolink ); >-- >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 26641
:
111395
|
111461
|
111462
|
111463
|
111829
|
111868
|
111869