Bug 26051: We should sort callnumber based on cn-sort

In zebra we sort by callnumber using 8007 cn-sort

We should do the same in elasticsearch

To test:
1 - Have Koha using Elasticsearch
2 - Perform a search
3 - Attempt to sort by callnumber
4 - Error in logs: No mapping found for [local-classification__sort]
5 - Apply patch
6 - Restart all
7 - Perform a search and sort by callnumber
8 - Success!

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a52a0f80b8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 726da17134)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2021-01-08 13:14:42 +00:00 committed by Andrew Fuerste-Henry
parent 4e4d8abea0
commit 7ca057d03d
2 changed files with 3 additions and 3 deletions

View File

@ -589,7 +589,7 @@ sub _convert_sort_fields {
my %sort_field_convert = (
acqdate => 'date-of-acquisition',
author => 'author',
call_number => 'local-classification',
call_number => 'cn-sort',
popularity => 'issues',
relevance => undef, # default
title => 'title',

View File

@ -703,7 +703,7 @@ subtest "_convert_sort_fields() tests" => sub {
is_deeply(
\@sort_by,
[
{ field => 'local-classification', direction => 'asc' },
{ field => 'cn-sort', direction => 'asc' },
{ field => 'author', direction => 'desc' }
],
'sort fields should have been split correctly'
@ -714,7 +714,7 @@ subtest "_convert_sort_fields() tests" => sub {
is_deeply(
\@sort_by,
[
{ field => 'local-classification', direction => 'asc' },
{ field => 'cn-sort', direction => 'asc' },
{ field => 'author', direction => 'desc' }
],
'sort fields should have been split correctly'