Bugzilla – Attachment 156498 Details for
Bug 34822
BatchUpdateBiblioHoldsQueue should be called once per import batch when using RealTimeHoldsQueue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34822: Process real time holds along with indexing
Bug-34822-Process-real-time-holds-along-with-index.patch (text/plain), 3.42 KB, created by
Katrin Fischer
on 2023-10-03 11:27:37 UTC
(
hide
)
Description:
Bug 34822: Process real time holds along with indexing
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-10-03 11:27:37 UTC
Size:
3.42 KB
patch
obsolete
>From cecb591da9217454cde791206c4be33992bc7927 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 18 Sep 2023 17:25:15 +0000 >Subject: [PATCH] Bug 34822: Process real time holds along with indexing > >Current code already skips indexing when adding record to instead index in a single call. This patch pdates the code to do the same thing for real time holds queue updates. > >Note: Newly added records do not need to be updated as they won't have holds yet. > >To test: >1 - Have a marc file with several records that match records in your catalog > You can export part of your catalog to generate one >2 - Set system preference: RealTimeHoldsQueue to 'enable' >3 - Stage and import file, make sure you are matching and overlaying >4 - Go to Administration->Manage jobs >5 - Note a batch update for each updated record >6 - Apply patch >7 - Repeat >8 - Note a single job added for the entire batch containing only updated records > >Signed-off-by: Sam Lau <samalau@gmail.com> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/ImportBatch.pm | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index b950d193bd..00fd7f3d43 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -34,6 +34,7 @@ use C4::Items qw( AddItemFromMarc ModItemFromMarc ); > use C4::Charset qw( MarcToUTF8Record SetUTF8Flag StripNonXmlChars ); > use C4::AuthoritiesMarc qw( AddAuthority GuessAuthTypeCode GetAuthorityXML ModAuthority DelAuthority GetAuthorizedHeading ); > use C4::MarcModificationTemplates qw( ModifyRecordWithTemplate ); >+use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; > use Koha::Items; > use Koha::SearchEngine; > use Koha::SearchEngine::Indexer; >@@ -568,6 +569,7 @@ sub BatchCommitRecords { > > my $rec_num = 0; > my @biblio_ids; >+ my @updated_ids; > while (my $rowref = $sth->fetchrow_hashref) { > $record_type = $rowref->{'record_type'}; > >@@ -662,10 +664,12 @@ sub BatchCommitRecords { > $overlay_framework // $oldbiblio->frameworkcode, > { > overlay_context => $context, >- skip_record_index => 1 >+ skip_record_index => 1, >+ skip_holds_queue => 1, > } > ); > push @biblio_ids, $recordid; >+ push @updated_ids, $recordid; > $query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead > > if ($item_result eq 'create_new' || $item_result eq 'replace') { >@@ -717,10 +721,12 @@ sub BatchCommitRecords { > # final commit should be before Elastic background indexing in order to find job data > $schema->txn_commit; > >- if ( @biblio_ids ) { >- my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); >+ if (@biblio_ids) { >+ my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); > $indexer->index_records( \@biblio_ids, "specialUpdate", "biblioserver" ); > } >+ Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => \@updated_ids } ) >+ if ( @updated_ids && C4::Context->preference('RealTimeHoldsQueue') ); > > return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); > } >-- >2.30.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 34822
:
155856
|
155857
|
156231
| 156498