From 470c3913a4e59399984634ef4cacbce2e8318732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Thu, 30 Apr 2020 07:51:14 +0200 Subject: [PATCH] Bug 25325 ElasticSearch mapping export lacks staff_client/opac fields Add to export_elasticsearch_mappings.pl two missing fields: staff_client and opac. Test plan: 1. Run export_elasticsearch_mappings.pl script. Write the result in mappings.yaml (the one defined in koha-conf.xml). 2. In Admin > Search engine configuration, click on Reset Mappings 3. Confirm that in Search fields tab, the Searchable column hasn't changed. Signed-off-by: Victor Grousset/tuxayo --- Koha/SearchEngine/Elasticsearch.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 6616671325..4b92c7de1f 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -273,25 +273,26 @@ sub raw_elasticsearch_mappings { ); while ( my $marc_to_field = $marc_to_fields->next ) { - my $marc_map = $marc_to_field->search_marc_map; next if $marc_type && $marc_map->marc_type ne $marc_type; - $mappings->{ $marc_map->index_name }{ $search_field->name }{label} = $search_field->label; - $mappings->{ $marc_map->index_name }{ $search_field->name }{type} = $search_field->type; - $mappings->{ $marc_map->index_name }{ $search_field->name }{facet_order} = $search_field->facet_order if defined $search_field->facet_order; - $mappings->{ $marc_map->index_name }{ $search_field->name }{weight} = $search_field->weight if defined $search_field->weight; + my $field = $mappings->{ $marc_map->index_name }->{ $search_field->name } = {}; + $field->{label} = $search_field->label; + $field->{type} = $search_field->type; + $field->{facet_order} = $search_field->facet_order if defined $search_field->facet_order; + $field->{weight} = $search_field->weight if defined $search_field->weight; + $field->{opac} = $search_field->opac if defined $search_field->opac; + $field->{staff_client} = $search_field->staff_client if defined $search_field->staff_client; - push (@{ $mappings->{ $marc_map->index_name }{ $search_field->name }{mappings} }, + push @{ $field->{mappings} }, { facet => $marc_to_field->facet || '', marc_type => $marc_map->marc_type, marc_field => $marc_map->marc_field, sort => $marc_to_field->sort, suggestible => $marc_to_field->suggestible || '' - }); - + }; } } -- 2.26.2