Browse Source

Bug 23204: (follow-up) Also sort by marc field

Test plan :
Launching script several times and see that marc field is alway ordered increasing

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Fridolin Somers 2 years ago
committed by Martin Renvoize
parent
commit
0c9585333d
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 11
      Koha/SearchEngine/Elasticsearch.pm

11
Koha/SearchEngine/Elasticsearch.pm

@ -263,10 +263,17 @@ sub raw_elasticsearch_mappings {
my $mappings = {};
while ( my $search_field = $search_fields->next ) {
my $marc_to_fields = $schema->resultset('SearchMarcToField')->search( { search_field_id => $search_field->id } );
my $marc_to_fields = $schema->resultset('SearchMarcToField')->search(
{ search_field_id => $search_field->id },
{
join => 'search_marc_map',
order_by => { -asc => 'search_marc_map.marc_field' }
}
);
while ( my $marc_to_field = $marc_to_fields->next ) {
my $marc_map = Koha::SearchMarcMaps->find( $marc_to_field->search_marc_map_id );
my $marc_map = $marc_to_field->search_marc_map;
next if $marc_type && $marc_map->marc_type ne $marc_type;

Loading…
Cancel
Save