Bugzilla – Attachment 132995 Details for
Bug 27344
Implement Elastic's update_index_background using Koha::BackgroundJob
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27344: Fix call to update_index with invalid ids
Bug-27344-Fix-call-to-updateindex-with-invalid-ids.patch (text/plain), 2.20 KB, created by
Jonathan Druart
on 2022-04-06 12:39:19 UTC
(
hide
)
Description:
Bug 27344: Fix call to update_index with invalid ids
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-04-06 12:39:19 UTC
Size:
2.20 KB
patch
obsolete
>From 5be09bd2833df5978ee5ffcbe71fc42b7ecf5e56 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 6 Apr 2022 14:38:04 +0200 >Subject: [PATCH] Bug 27344: Fix call to update_index with invalid ids > >Can't use an undefined value as an ARRAY reference at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Indexer.pm line 121. > >Caught that when working on follow-up bug reports. >--- > Koha/SearchEngine/Elasticsearch/Indexer.pm | 2 +- > .../Koha/SearchEngine/Elasticsearch/Indexer.t | 18 +++++++++++++++++- > 2 files changed, 18 insertions(+), 2 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/Indexer.pm b/Koha/SearchEngine/Elasticsearch/Indexer.pm >index 1aa426a6a21..ca0d19a442b 100644 >--- a/Koha/SearchEngine/Elasticsearch/Indexer.pm >+++ b/Koha/SearchEngine/Elasticsearch/Indexer.pm >@@ -100,7 +100,7 @@ Arrayref of C<MARC::Record>s. > sub update_index { > my ($self, $record_ids, $records) = @_; > >- my $index_record_ids; >+ my $index_record_ids = []; > unless ( $records && @$records ) { > for my $record_id ( sort { $a <=> $b } @$record_ids ) { > >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t >index 70e6ab073d6..2b84a24f39f 100755 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::MockModule; > use Test::Warn; > use t::lib::Mocks; >@@ -120,6 +120,22 @@ subtest 'index_records() tests' => sub { > } > "Update background " . $biblio->biblionumber, > "When passing id only to index_records the marc record is fetched and passed through to update_index"; >+ >+}; >+ >+subtest 'update_index' => sub { >+ plan tests => 1; >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $biblionumber = $biblio->biblionumber; >+ $biblio->delete; >+ >+ my $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new({ 'index' => 'biblios' }); >+ warning_is { >+ $indexer->update_index([$biblionumber]); >+ >+ } "", "update_index called with deleted biblionumber should not crash"; >+ > }; > > } >-- >2.25.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 27344
:
114877
|
116252
|
116931
|
132444
|
132445
|
132446
|
132586
|
132609
|
132610
|
132611
|
132612
|
132613
|
132645
|
132646
|
132794
|
132795
|
132796
|
132797
|
132798
|
132843
|
132844
|
132845
|
132969
|
132970
|
132994
|
132995
|
133033
|
134406
|
134407
|
134408
|
134409
|
134410
|
134411
|
134412
|
134413