[Koha-devel] A patch for sorting by call_number in ES

Zeno Tajoli ztajoli at gmail.com
Wed Jan 20 23:51:29 CET 2021


Hi to all,

in default ES setup sort by call_number  is not working.
Inside Koha/SearchEngine/Elasticsearch/QueryBuilder.pm, routine 
_convert_sort_fields there is this fix convection:

call_number => 'local-classification',

'call_number' is the string used in the search abstraction level for 
index used for sort with call numbers

'local-classification' is the name of the ES index selected for sorting 
by call numbers

I think that the selection of 'local-classification' as standard sort 
index for call numbers is not a good idea.
I think is better to use the ES index 'cn-sort' that is connect with 
952$6 [MARC21] and 995$s[Unimarc] and the mysql field items.cn_sort.
items.cn_sort is the normalized form of the call number used for sorting.

I can write a patch to connect cn-sort with 'call_number' and fix also 
default setup of admin/searchengine/elasticsearch/mappings.yaml, 
inserting 'cn-sort' as sortable.

What do you think ?

Cheers
Zeno Tajoli

-- 
Zeno Tajoli
System Librarian


More information about the Koha-devel mailing list