Bugzilla – Attachment 110264 Details for
Bug 25265
Elasticsearch - Batch editing items on a biblio can lead to incorrect index
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25265: Rename skip_modzebra_update to skip_record_index
Bug-25265-Rename-skipmodzebraupdate-to-skiprecordi.patch (text/plain), 10.41 KB, created by
Nick Clemens (kidclamp)
on 2020-09-17 12:56:58 UTC
(
hide
)
Description:
Bug 25265: Rename skip_modzebra_update to skip_record_index
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-09-17 12:56:58 UTC
Size:
10.41 KB
patch
obsolete
>From 6700f47507c869b72dc983c2e5fda48d52a12ce3 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 17 Sep 2020 12:55:53 +0000 >Subject: [PATCH] Bug 25265: Rename skip_modzebra_update to skip_record_index > >--- > C4/Circulation.pm | 6 +++--- > C4/Items.pm | 12 ++++++------ > Koha/Item.pm | 8 ++++---- > cataloguing/additem.pl | 4 ++-- > t/db_dependent/Koha/SearchEngine/Indexer.t | 12 ++++++------ > tools/batchMod.pl | 4 ++-- > 6 files changed, 23 insertions(+), 23 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 203370e1a3..716c1db4e0 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3721,13 +3721,13 @@ sub ReturnLostItem{ > LostItem( $itemnumber, $mark_lost_from, $force_mark_returned, [$params] ); > > The final optional parameter, C<$params>, expected to contain >-'skip_modzebra_update' key, which relayed down to Koha::Item/store, >+'skip_record_index' key, which relayed down to Koha::Item/store, > there it prevents calling of ModZebra index_records, > which takes most of the time in batch adds/deletes: index_records better > to be called later in C<additem.pl> after the whole loop. > > $params: >- skip_modzebra_update => 1|0 >+ skip_record_index => 1|0 > > =cut > >@@ -3783,7 +3783,7 @@ sub LostItem{ > > #When item is marked lost automatically cancel its outstanding transfers and set items holdingbranch to the transfer source branch (frombranch) > if (my ( $datesent,$frombranch,$tobranch ) = GetTransfers($itemnumber)) { >- Koha::Items->find($itemnumber)->holdingbranch($frombranch)->store({ skip_modzebra_update => $params->{skip_modzebra_update} }); >+ Koha::Items->find($itemnumber)->holdingbranch($frombranch)->store({ skip_record_index => $params->{skip_record_index} }); > } > my $transferdeleted = DeleteTransfer($itemnumber); > } >diff --git a/C4/Items.pm b/C4/Items.pm >index 53951abfc3..9da7f61fc6 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -144,13 +144,13 @@ Given a MARC::Record object containing an embedded item > record and a biblionumber, create a new item record. > > The final optional parameter, C<$params>, expected to contain >-'skip_modzebra_update' key, which relayed down to Koha::Item/store, >+'skip_record_index' key, which relayed down to Koha::Item/store, > there it prevents calling of index_records, > which takes most of the time in batch adds/deletes: index_records > to be called later in C<additem.pl> after the whole loop. > > $params: >- skip_modzebra_update => 1|0 >+ skip_record_index => 1|0 > > =cut > >@@ -174,7 +174,7 @@ sub AddItemFromMarc { > $item_values->{biblionumber} = $biblionumber; > $item_values->{cn_source} = delete $item_values->{'items.cn_source'}; # Because of C4::Biblio::_disambiguate > $item_values->{cn_sort} = delete $item_values->{'items.cn_sort'}; # Because of C4::Biblio::_disambiguate >- my $item = Koha::Item->new( $item_values )->store({ skip_modzebra_update => $params->{skip_modzebra_update} }); >+ my $item = Koha::Item->new( $item_values )->store({ skip_record_index => $params->{skip_record_index} }); > return ( $item->biblionumber, $item->biblioitemnumber, $item->itemnumber ); > } > >@@ -287,13 +287,13 @@ sub AddItemBatchFromMarc { > my $item = ModItemFromMarc($item_marc, $biblionumber, $itemnumber[, $params]); > > The final optional parameter, C<$params>, expected to contain >-'skip_modzebra_update' key, which relayed down to Koha::Item/store, >+'skip_record_index' key, which relayed down to Koha::Item/store, > there it prevents calling of index_records, > which takes most of the time in batch adds/deletes: index_records better > to be called later in C<additem.pl> after the whole loop. > > $params: >- skip_modzebra_update => 1|0 >+ skip_record_index => 1|0 > > =cut > >@@ -327,7 +327,7 @@ sub ModItemFromMarc { > $item_object = $item_object->set_or_blank($item); > my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); > $item_object->more_subfields_xml(_get_unlinked_subfields_xml($unlinked_item_subfields)); >- $item_object->store({ skip_modzebra_update => $params->{skip_modzebra_update} }); >+ $item_object->store({ skip_record_index => $params->{skip_record_index} }); > > return $item_object->unblessed; > } >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 2082b6350e..a96106e2b8 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -61,7 +61,7 @@ Koha::Item - Koha Item object class > > $item->store; > >-$params can take an optional 'skip_modzebra_update' parameter. >+$params can take an optional 'skip_record_index' parameter. > If set, the reindexation process will not happen (index_records not called) > > NOTE: This is a temporary fix to answer a performance issue when lot of items >@@ -113,7 +113,7 @@ sub store { > > my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); > $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" ) >- unless $params->{skip_modzebra_update}; >+ unless $params->{skip_record_index}; > > logaction( "CATALOGUING", "ADD", $self->itemnumber, "item" ) > if $log_action && C4::Context->preference("CataloguingLog"); >@@ -190,7 +190,7 @@ sub store { > > my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); > $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" ) >- unless $params->{skip_modzebra_update}; >+ unless $params->{skip_record_index}; > > $self->_after_item_action_hooks({ action => 'modify' }); > >@@ -218,7 +218,7 @@ sub delete { > > my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); > $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" ) >- unless $params->{skip_modzebra_update}; >+ unless $params->{skip_record_index}; > > $self->_after_item_action_hooks({ action => 'delete' }); > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 34504c37a6..9f6d59a5fc 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -615,7 +615,7 @@ if ($op eq "additem") { > # Adding the item > if (!$exist_itemnumber) { > my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = >- AddItemFromMarc( $record, $biblionumber, { skip_modzebra_update => 1 } ); >+ AddItemFromMarc( $record, $biblionumber, { skip_record_index => 1 } ); > set_item_default_location($oldbibitemnum); > > # We count the item only if it was really added >@@ -705,7 +705,7 @@ if ($op eq "additem") { > #------------------------------------------------------------------------------- > my $items = Koha::Items->search({ biblionumber => $biblionumber }); > while ( my $item = $items->next ) { >- $error = $item->safe_delete({ skip_modzebra_update => 1 }); >+ $error = $item->safe_delete({ skip_record_index => 1 }); > next if ref $error eq 'Koha::Item'; # Deleted item is returned if deletion successful > push @errors,$error; > } >diff --git a/t/db_dependent/Koha/SearchEngine/Indexer.t b/t/db_dependent/Koha/SearchEngine/Indexer.t >index fa245f8880..17f3832bac 100755 >--- a/t/db_dependent/Koha/SearchEngine/Indexer.t >+++ b/t/db_dependent/Koha/SearchEngine/Indexer.t >@@ -99,8 +99,8 @@ subtest 'Test indexer calls' => sub { > $item2 = $builder->build_sample_item({biblionumber => $biblio->biblionumber}); > } [$engine,"Koha::Item",$engine,"Koha::Item"], "index_records is called for $engine when adding an item (Item->store)"; > warnings_are{ >- $item->store({ skip_modzebra_update => 1 }); >- } undef, "index_records is not called for $engine when adding an item (Item->store) if skip_modzebra_update passed"; >+ $item->store({ skip_record_index => 1 }); >+ } undef, "index_records is not called for $engine when adding an item (Item->store) if skip_record_index passed"; > > $builder->build({ > source => 'Branchtransfer', >@@ -118,15 +118,15 @@ subtest 'Test indexer calls' => sub { > datearrived => undef} > }); > warnings_are{ >- LostItem( $item->itemnumber, "tests", undef, { skip_modzebra_update => 1 }); >- } undef, "index_records is not called for $engine when calling LostItem and transfer exists if skip_modzebra_update"; >+ LostItem( $item->itemnumber, "tests", undef, { skip_record_index => 1 }); >+ } undef, "index_records is not called for $engine when calling LostItem and transfer exists if skip_record_index"; > > warnings_are{ > $item->delete(); > } [$engine,"Koha::Item"], "index_records is called for $engine when deleting an item (Item->delete)"; > warnings_are{ >- $item2->delete({ skip_modzebra_update => 1 }); >- } undef, "index_records is not called for $engine when adding an item (Item->store) if skip_modzebra_update passed"; >+ $item2->delete({ skip_record_index => 1 }); >+ } undef, "index_records is not called for $engine when adding an item (Item->store) if skip_record_index passed"; > > warnings_are{ > DelBiblio( $biblio->biblionumber ); >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index ba7d970e17..3a227e6022 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -302,7 +302,7 @@ if ($op eq "action") { > $localmarcitem, > $itemdata->{biblionumber}, > $itemnumber, >- { skip_modzebra_update => 1 }, >+ { skip_record_index => 1 }, > ) > ) > { >@@ -310,7 +310,7 @@ if ($op eq "action") { > $itemnumber, > 'batchmod', > undef, >- { skip_modzebra_update => 1 } >+ { skip_record_index => 1 } > ) if $item->{itemlost} > and not $itemdata->{itemlost}; > } >-- >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 25265
:
107832
|
107855
|
107867
|
109538
|
109556
|
110262
|
110263
|
110264
|
110380
|
110381
|
110382
|
110457
|
110458
|
110459
|
110560
|
110561
|
110562
|
110565
|
110594
|
110595
|
110596
|
110597
|
110615
|
110618
|
110729
|
110730
|
110731
|
110732
|
110733
|
110734
|
110736
|
110737
|
110882
|
110883
|
110937