@@ -, +, @@ --- Koha/SearchEngine/Elasticsearch.pm | 1 + Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 3 --- admin/searchengine/elasticsearch/field_config.yaml | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) --- a/Koha/SearchEngine/Elasticsearch.pm +++ a/Koha/SearchEngine/Elasticsearch.pm @@ -832,6 +832,7 @@ sub _get_marc_mapping_rules { if ($type eq 'sum') { push @{$rules->{sum}}, $name; + push @{$rules->{sum}}, $name."__sort" if $sort; } elsif ($type eq 'isbn') { push @{$rules->{isbn}}, $name; --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -992,9 +992,6 @@ sub _sort_field { my $textField = defined $mappings->{data}{properties}{$f}{type} && $mappings->{data}{properties}{$f}{type} eq 'text'; if (!defined $self->sort_fields()->{$f} || $self->sort_fields()->{$f}) { $f .= '__sort'; - # We need to add '.phrase' to text fields, otherwise it'll sort - # based on the tokenised form. - $f .= '.phrase' if $textField; } else { # We need to add '.raw' to text fields without a sort field, # otherwise it'll sort based on the tokenised form. --- a/admin/searchengine/elasticsearch/field_config.yaml +++ a/admin/searchengine/elasticsearch/field_config.yaml @@ -65,3 +65,4 @@ sort: default: type: icu_collation_keyword index: false + numeric: true --