From 4a2d8110cd3fea214f421c6fc677ec9063bb9dde Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 23 Sep 2020 18:57:26 +0000 Subject: [PATCH] Bug 25265: (follow-up) Don't index malformed records This is analogous to 26522, we shoudl skip record that cannot be retrieved for indexing --- Koha/SearchEngine/Elasticsearch/Indexer.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/Indexer.pm b/Koha/SearchEngine/Elasticsearch/Indexer.pm index 49437cd268..dab246f7c1 100644 --- a/Koha/SearchEngine/Elasticsearch/Indexer.pm +++ b/Koha/SearchEngine/Elasticsearch/Indexer.pm @@ -300,15 +300,19 @@ sub index_records { $biblionumbers = [$biblionumbers] if ref $biblionumbers ne 'ARRAY' && defined $biblionumbers; $records = [$records] if ref $records ne 'ARRAY' && defined $records; if ( $op eq 'specialUpdate' ) { + my $index_biblionumbers; unless ($records) { foreach my $biblionumber ( @$biblionumbers ){ my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber, embed_items => 1 }); - push @$records, $record; + if( $record ){ + push @$records, $record; + push @$index_biblionumbers, $biblionumber; + } } } - $self->update_index_background( $biblionumbers, $records ); + $self->update_index_background( $index_biblionumbers, $records ); } elsif ( $op eq 'recordDelete' ) { $self->delete_index_background( $biblionumbers ); -- 2.11.0