Bugzilla – Attachment 134648 Details for
Bug 30460
BatchDeleteBiblio task does not deal with indexation correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30460: Make BatchDeleteBiblio update the index in one request
Bug-30460-Make-BatchDeleteBiblio-update-the-index-.patch (text/plain), 2.41 KB, created by
Martin Renvoize (ashimema)
on 2022-05-05 14:55:25 UTC
(
hide
)
Description:
Bug 30460: Make BatchDeleteBiblio update the index in one request
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-05-05 14:55:25 UTC
Size:
2.41 KB
patch
obsolete
>From 2c96118be7adecd90429ceceeff9f16684059235 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 6 Apr 2022 13:20:12 +0200 >Subject: [PATCH] Bug 30460: Make BatchDeleteBiblio update the index in one > request > >No need to send 1 indexation request per item + 1 per biblio. > >Test plan: >Confirm that the batch biblio deletion tool still works correctly > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/BackgroundJob/BatchDeleteBiblio.pm | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > >diff --git a/Koha/BackgroundJob/BatchDeleteBiblio.pm b/Koha/BackgroundJob/BatchDeleteBiblio.pm >index efd9af2bf4..2f75bcf9b3 100644 >--- a/Koha/BackgroundJob/BatchDeleteBiblio.pm >+++ b/Koha/BackgroundJob/BatchDeleteBiblio.pm >@@ -3,9 +3,12 @@ package Koha::BackgroundJob::BatchDeleteBiblio; > use Modern::Perl; > use JSON qw( encode_json decode_json ); > >-use Koha::DateUtils qw( dt_from_string ); > use C4::Biblio; > >+use Koha::DateUtils qw( dt_from_string ); >+use Koha::SearchEngine; >+use Koha::SearchEngine::Indexer; >+ > use base 'Koha::BackgroundJob'; > > =head1 NAME >@@ -107,7 +110,7 @@ sub process { > # Delete items > my $items = Koha::Items->search({ biblionumber => $biblionumber }); > while ( my $item = $items->next ) { >- my $deleted = $item->safe_delete; >+ my $deleted = $item->safe_delete({ skip_record_index => 1 }); > unless ( $deleted ) { > push @messages, { > type => 'error', >@@ -124,7 +127,7 @@ sub process { > > # Finally, delete the biblio > my $error = eval { >- C4::Biblio::DelBiblio( $biblionumber ); >+ C4::Biblio::DelBiblio( $biblionumber, { skip_record_index => 1 } ); > }; > if ( $error or $@ ) { > push @messages, { >@@ -148,6 +151,15 @@ sub process { > $self->progress( ++$job_progress )->store; > } > >+ my @deleted_biblionumbers = >+ map { $_->{code} eq 'biblio_deleted' ? $_->{biblionumber} : () } >+ @messages; >+ >+ if ( @deleted_biblionumbers ) { >+ my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); >+ $indexer->index_records( \@deleted_biblionumbers, "recordDelete", "biblioserver" ); >+ } >+ > my $job_data = decode_json $self->data; > $job_data->{messages} = \@messages; > $job_data->{report} = $report; >-- >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 30460
:
132989
|
134402
| 134648