From 8b28e0d2b1a0ad55034350448e3bb4a03989bd0e Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 22 Sep 2021 12:55:19 +0000 Subject: [PATCH] Bug 29077: Remove blank indexes before convert To test: 1 - Be using Elasticsearch 2 - Search on OPAC with dropdown set to 'Library catalog' 3 - Warns in plack-opac-error.log 4 - Apply patch 5 - Repeat 6 - No warns 7 - Search returns correct results Signed-off-by: Aleisha Amohia Signed-off-by: Martin Renvoize --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 3e2cb1b784..43ee56684d 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -714,6 +714,8 @@ sub _convert_index_fields { my %index_type_convert = ( __default => undef, phr => 'phrase', rtrn => 'right-truncate', 'st-year' => 'st-year' ); + @indexes = grep(/.+/, @indexes); # Remove any blank indexes, i.e. keyword + # Convert according to our table, drop anything that doesn't convert. # If a field starts with mc- we save it as it's used (and removed) later # when joining things, to indicate we make it an 'OR' join. -- 2.20.1