From b216f20dd684c80663567b17f9005e79e113abb2 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 Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- 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 c7476a0144..89b0b8daef 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -524,7 +524,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.39.5