From a602b821b1a23c545ab3682109cad24d81d75352 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 27 May 2024 07:03:21 +0000 Subject: [PATCH] Bug 36947: [Alternate] Do a locale-based sort for ES facet names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change causes the locale system to be used when sorting for ES facet names. Test plan: 0. Apply the patch 1. vi "/etc/default/koha-common" 2. Add the following to the bottom of the file: export LC_ALL=fi_FI.UTF-8 3. koha-plack --restart koha-common 4. Setup some test records with authors with accented and unaccented names, and different cases for the lead letter e.g. Aa author, Åa author2, aa author3, étienne 5. Switch to using Elasticsearch and reindex koha-elasticsearch -b -v --rebuild kohadev 6. Do a test search e.g. http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=test 7. Confirm the facet names are sorted in ascending order following Finnish collation rules e.g. Aa author aa author3 étienne Farley, David Humble, Jez Martin, Robert C. Åa author NOTE: Any collation and language can be used. Finnish is just an example of a Latin-based script which has a different alphabetical ordering than just A-Z --- Koha/SearchEngine/Elasticsearch/Search.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm index 54e6e644dc..9a770dd5c9 100644 --- a/Koha/SearchEngine/Elasticsearch/Search.pm +++ b/Koha/SearchEngine/Elasticsearch/Search.pm @@ -438,6 +438,7 @@ C, C, etc. =cut sub _convert_facets { + use locale; my ( $self, $es, $exp_facet ) = @_; return if !$es; -- 2.39.2