From 60dcf0ae8f0093b14f6bc4d4ae8309e6dc84a94f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 3 Apr 2020 12:14:27 +0000 Subject: [PATCH] Bug 25050: Adjust marc_records_to_documents to search entire mapping array There was an assumption in the ES code that match-heading mappings will appear in a specified portion of the mappings array. Certain mappings setups will not meet this assumption. We need to move our searching up one level The key seems to be having a mapping for a complete field, say 150, in both the match-heading and another field as well as having mappings for ungrouped fields like 150a 150ab etc. The unit test coverage should be sufficient for testing Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Jonathan Druart --- Koha/SearchEngine/Elasticsearch.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 8ee939d2be..19fa2a47fa 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -577,7 +577,7 @@ sub marc_records_to_documents { } ); } - if ( defined @{$mappings}[0] && grep /match-heading/, @{@{$mappings}[0]} ){ + if ( @{$mappings} && grep { $_->[0] eq 'match-heading'} @{$mappings} ){ # Used by the authority linker the match-heading field requires a specific syntax # that is specified in C4/Heading my $heading = C4::Heading->new_from_field( $field, undef, 1 ); #new auth heading -- 2.20.1