Koha-clms/Koha/SearchEngine
Martin Renvoize 53488ff01c
Bug 36947: Add system preference for configurable locale-based facet sorting
This follow-up adds two major enhancements to the locale-based facet sorting
implementation:

1. **System Preference Integration**
   - Adds FacetSortingLocale system preference for configurable locale selection
   - Dynamically detects available system locales using Koha::I18N
   - Provides user-friendly dropdown with locale descriptions
   - Supports both Elasticsearch and Zebra search engines

2. **Zebra Search Engine Support**
   - Extends locale-based sorting to Zebra (in addition to existing Elasticsearch)
   - Implements _sort_facets_zebra() function in C4::Search
   - Maintains consistent Unicode-aware sorting behavior across search engines

Key Features:
- Dynamic locale detection via Koha::I18N::available_locales()
- Proper module architecture with comprehensive unit tests
- Clean fallback chain: preference → system LC_COLLATE → default
- Admin UI integration in System Preferences → I18N/L10N
- Universal facet sorting for international library systems

Test plan:
1. Apply patch and restart services
2. Install/run database update
3. Navigate to Administration → System Preferences → I18N/L10N
4. Verify "Sort facet names using" dropdown shows available system locales
5. Test facet sorting with different locales and both search engines
6. Run: prove t/Koha/I18N.t t/Koha/SearchEngine/Elasticsearch/Search.t t/db_dependent/Search_FacetSorting.t

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 146aca25f5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:42 +02:00
..
Elasticsearch Bug 36947: Add system preference for configurable locale-based facet sorting 2025-07-24 10:23:42 +02:00
Zebra Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Elasticsearch.pm Bug 39503: Collapse thesaurus if value in 008_/11 = 'z' and 040 $f 2025-05-13 18:47:00 +02:00
Indexer.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
QueryBuilder.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Search.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00