Bug 29697: (follow-up) Indexing a deleted record is not expected to crash

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2022-07-22 15:49:22 -03:00
parent cb8aaff8c3
commit 8a1d667408
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 12 additions and 3 deletions

View File

@ -336,9 +336,18 @@ sub index_records {
sub _get_record {
my ( $self, $record_id ) = @_;
return $self->index eq $Koha::SearchEngine::BIBLIOS_INDEX
? Koha::Biblios->find($record_id)->metadata->record({ embed_items => 1 })
: C4::AuthoritiesMarc::GetAuthority($record_id);
my $record;
if ( $self->index eq $Koha::SearchEngine::BIBLIOS_INDEX ) {
my $biblio = Koha::Biblios->find($record_id);
$record = $biblio->metadata->record( { embed_items => 1 } )
if $biblio;
} else {
$record = C4::AuthoritiesMarc::GetAuthority($record_id);
}
return $record;
}
=head2 delete_index($biblionums)