From 4611415fe62990118e75f38500c10d6300173c20 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 23 Sep 2020 17:58:00 +0000 Subject: [PATCH] Bug 26522: Don't index record if no record is retrieved Currently if we cannot load the marc record, we die. This patch simply skips the malformed record during indexing Eventually we should warn or pass back an exception, but we can use compare_es_to_db.pl to identify problematic records and should fix this issue to prevent import from dying To test: 1 - Export or create a bib with malformed data In sample data search for 'udgave' the record has 942 _6_ 2 - Set System preference SearchEngine to Elasticsearch 3 - Import the record 4 - Import fails 5 - Check intranet-error.log, see warning about calling leader on undefined value 6 - Apply patch 7 - Import again 8 - Success, import succeeds 9 - Search for 'udgave' or term that returns your record 10 - The record should not be findable --- C4/Biblio.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 46fb544a9c..c02215393a 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2525,7 +2525,7 @@ sub ModZebra { biblionumber => $biblionumber, embed_items => 1 }); } - $indexer->update_index_background( [$biblionumber], [$record] ); + $indexer->update_index_background( [$biblionumber], [$record] ) if $record; } elsif ( $op eq 'recordDelete' ) { $indexer->delete_index_background( [$biblionumber] ); -- 2.11.0