Bugzilla – Attachment 107832 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: Prevent double reindex of the same item in batchmod
Bug-25265-Prevent-double-reindex-of-the-same-item-.patch (text/plain), 3.00 KB, created by
Jonathan Druart
on 2020-08-05 12:23:16 UTC
(
hide
)
Description:
Bug 25265: Prevent double reindex of the same item in batchmod
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-05 12:23:16 UTC
Size:
3.00 KB
patch
obsolete
>From f1058d8e8497f76658781c2fe5b9c9a1607e4143 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 5 Aug 2020 14:20:47 +0200 >Subject: [PATCH] Bug 25265: Prevent double reindex of the same item in > batchmod > >When batch editing, 2 reindex calls are sent to ES/Zebra. >We can easily avoid that reusing the skip_modzebra_update > >Test plan: >1 - Have a bib with several items, none marked 'not for loan' >2 - Do a staff search that returns this biblio >3 - Items show as available >4 - Click on title to go to details page >5 - Edit->Item in a batch >6 - Set the not for loan status for all items >7 - Repeat your search >8 - Items show as not for loan >--- > C4/Items.pm | 21 +++++++++++++++++---- > tools/batchMod.pl | 3 ++- > 2 files changed, 19 insertions(+), 5 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index f2db7a4894..9373e45892 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -281,10 +281,23 @@ sub AddItemBatchFromMarc { > return (\@itemnumbers, \@errors); > } > >+=head2 ModItemFromMarc >+ >+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, >+there it prevents calling of ModZebra (and Elasticsearch update), >+which takes most of the time in batch adds/deletes: ModZebra better >+to be called later in C<additem.pl> after the whole loop. >+ >+$params: >+ skip_modzebra_update => 1|0 >+ >+=cut >+ > sub ModItemFromMarc { >- my $item_marc = shift; >- my $biblionumber = shift; >- my $itemnumber = shift; >+ my ( $item_marc, $biblionumber, $itemnumber, $params ) @_; > > my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber); > my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); >@@ -313,7 +326,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; >+ $item_object->store({ skip_modzebra_update => $params->{skip_modzebra_update} }); > > return $item_object->unblessed; > } >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index fe40f84c7e..4105a34dde 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -280,7 +280,8 @@ if ($op eq "action") { > my $item = ModItemFromMarc( > $localmarcitem, > $itemdata->{biblionumber}, >- $itemnumber >+ $itemnumber, >+ { skip_modzebra_update => 1 }, # LostItem will deal with the reindex > ) > ) > { >-- >2.20.1
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