|
Lines 54-59
use MARC::File::XML;
Link Here
|
| 54 |
use MIME::Base64 qw( decode_base64 ); |
54 |
use MIME::Base64 qw( decode_base64 ); |
| 55 |
use JSON; |
55 |
use JSON; |
| 56 |
|
56 |
|
|
|
57 |
use POSIX qw(setlocale LC_COLLATE); |
| 58 |
use Unicode::Collate::Locale; |
| 59 |
|
| 57 |
Koha::SearchEngine::Elasticsearch::Search->mk_accessors(qw( store )); |
60 |
Koha::SearchEngine::Elasticsearch::Search->mk_accessors(qw( store )); |
| 58 |
|
61 |
|
| 59 |
=head2 search |
62 |
=head2 search |
|
Lines 502-509
sub _convert_facets {
Link Here
|
| 502 |
}; |
505 |
}; |
| 503 |
} |
506 |
} |
| 504 |
if( C4::Context->preference('FacetOrder') eq 'Alphabetical' ){ |
507 |
if( C4::Context->preference('FacetOrder') eq 'Alphabetical' ){ |
| 505 |
@{ $facet->{facets} } = |
508 |
#Fetch locale as understood by Perl |
| 506 |
sort { $a->{facet_label_value} cmp $b->{facet_label_value} } @{ $facet->{facets} }; |
509 |
#NOTE: Technically, we can define locale however we like, but this |
|
|
510 |
#is a good default |
| 511 |
my $locale = setlocale(LC_COLLATE); |
| 512 |
|
| 513 |
#Create locale-based collator |
| 514 |
my $collator = Unicode::Collate::Locale->new( locale => $locale ); |
| 515 |
if ($collator) { |
| 516 |
@{ $facet->{facets} } = |
| 517 |
sort { $collator->cmp( $a->{facet_label_value}, $b->{facet_label_value} ) } @{ $facet->{facets} }; |
| 518 |
} |
| 507 |
} |
519 |
} |
| 508 |
push @facets, $facet if exists $facet->{facets}; |
520 |
push @facets, $facet if exists $facet->{facets}; |
| 509 |
} |
521 |
} |
| 510 |
- |
|
|