From e4a15bf5e5c471c6d2a692aa5d6bb295010ff993 Mon Sep 17 00:00:00 2001 From: Bertrand Zuchuat Date: Tue, 19 Sep 2023 08:55:30 +0200 Subject: [PATCH] items: sorting for standard holdings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Items sorting on standard holdings takes into consideration the numerical values in the character string. * Closes #2243. * Fixes noquery configuration on items sort. ⚠️ migration: items reindexing. Co-Authored-by: Bertrand Zuchuat --- rero_ils/config.py | 6 +++--- .../modules/items/mappings/v7/items/item-v0.0.1.json | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/rero_ils/config.py b/rero_ils/config.py index 6fe9bb5053..c080918f1a 100644 --- a/rero_ils/config.py +++ b/rero_ils/config.py @@ -2495,8 +2495,8 @@ def _(x): default_order='asc' ) RECORDS_REST_SORT_OPTIONS['items']['enumeration_chronology'] = dict( - fields=['-enumerationAndChronology'], title='Enumeration and Chronology', - default_order='desc' + fields=['enumerationAndChronology.sort'], title='Enumeration and Chronology', + default_order='asc' ) RECORDS_REST_SORT_OPTIONS['items']['library'] = dict( fields=['library.pid'], title='Library', @@ -2509,7 +2509,7 @@ def _(x): ) RECORDS_REST_DEFAULT_SORT['items'] = dict( - query='bestmatch', noquery='enum_chronology') + query='bestmatch', noquery='enumeration_chronology') # ------ ITEM TYPES SORT RECORDS_REST_SORT_OPTIONS['item_types']['name'] = dict( diff --git a/rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json b/rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json index 1edb3a3791..5ee6b692cd 100644 --- a/rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json +++ b/rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json @@ -56,7 +56,14 @@ } }, "enumerationAndChronology": { - "type": "keyword" + "type": "keyword", + "fields": { + "sort": { + "type": "icu_collation_keyword", + "index": false, + "numeric": true + } + } }, "location": { "properties": {