From 5561383a9ffe0f294b756ab3a56754901c34ceae Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 22 Mar 2024 10:04:08 +0100 Subject: [PATCH] Bug 36396: Export/import the yaml config Test plan: Export the ES fields/mappings using misc/search_tools/export_elasticsearch_mappings.pl > mappings.yaml Copy this file to admin/searchengine/elasticsearch/mappings.yaml Reset the mapping from the UI Notice that the links to the AV categories have been preserved Sponsored-by: The Research University in the Helmholtz Association (KIT) Signed-off-by: Lukas Koszyk Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- Koha/SearchEngine/Elasticsearch.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 5989e8ce4f..531d410e5b 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -288,6 +288,9 @@ sub raw_elasticsearch_mappings { $mappings->{ $marc_map->index_name }{ $search_field->name }{type} = $search_field->type; $mappings->{ $marc_map->index_name }{ $search_field->name }{mandatory} = $search_field->mandatory; $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 }{authorised_value_category} = + $search_field->authorised_value_category + if defined $search_field->authorised_value_category; $mappings->{ $marc_map->index_name }{ $search_field->name }{weight} = $search_field->weight if defined $search_field->weight; $mappings->{ $marc_map->index_name }{ $search_field->name }{opac} = $search_field->opac if defined $search_field->opac; $mappings->{ $marc_map->index_name }{ $search_field->name }{staff_client} = $search_field->staff_client if defined $search_field->staff_client; @@ -368,7 +371,7 @@ sub reset_elasticsearch_mappings { while ( my ( $index_name, $fields ) = each %$indexes ) { while ( my ( $field_name, $data ) = each %$fields ) { - my %sf_params = map { $_ => $data->{$_} } grep { exists $data->{$_} } qw/ type label weight staff_client opac facet_order mandatory/; + my %sf_params = map { $_ => $data->{$_} } grep { exists $data->{$_} } qw/ type label weight staff_client opac facet_order authorised_value_category mandatory/; # Set default values $sf_params{staff_client} //= 1; -- 2.39.5