From 5d4a4986b8dad5f38566fca83b23d22fdc1484a4 Mon Sep 17 00:00:00 2001 From: Andreas Jonsson Date: Thu, 16 May 2024 09:38:09 +0200 Subject: [PATCH] Bug 36879: Spurious warning in QueryBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test plan: With ElasticSearch enabled, * Perform a search using the default sort order (i.e. 'relevance'). * Verify that no warnings are generated in plack-intranet-error.log Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: wainuiwitikapark (cherry picked from commit 85ae71cfd4226a5af93f5650aae6ced34f1b8136) Signed-off-by: Frédéric Demians --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 015f7b42ed..653c7890e6 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -729,10 +729,11 @@ sub _convert_sort_fields { # Convert the fields and orders, drop anything we don't know about. grep { $_->{field} } map { my ( $f, $d ) = /(.+)_(.+)/; + defined $f && defined $d ? { field => $sort_field_convert{$f}, direction => $sort_order_convert{$d} - } + } : { field => undef }; } @sort_by; } -- 2.39.5