From ecadc62eb4da98fd8f56f8de2e95f6270e7dc14a Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Thu, 2 Nov 2017 15:02:23 +0100 Subject: [PATCH] Bug 19564: Fix extraction of sort order from sort condition name Currently sort order is extracted from sort condition by splitting the field, instead use regular expression to extract the last part preceded by underscore. Signed-off-by: Nicolas Legrand Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index d950891175..98a2d590b8 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -491,7 +491,7 @@ sub _convert_sort_fields { # Convert the fields and orders, drop anything we don't know about. grep { $_->{field} } map { - my ( $f, $d ) = split /_/; + my ( $f, $d ) = /(.+)_(.+)/; { field => $sort_field_convert{$f}, direction => $sort_order_convert{$d} -- 2.39.5