From acae8133f60c5b8ef16c5fa1d7369cdce3801ac1 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 28 Mar 2019 15:12:52 +0000 Subject: [PATCH] Bug 18235: (RM follow-up) fix mappings reset Without this we could not recreate mappings as there are no defaults for the additional fields - this restores behavoiur from before patches --- Koha/SearchEngine/Elasticsearch.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 5f9370db20..81b1a8dea5 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -285,11 +285,16 @@ sub reset_elasticsearch_mappings { my $field_label = $data->{label}; my $mappings = $data->{mappings}; my $facet_order = $data->{facet_order}; - my $search_field = Koha::SearchFields->find_or_create({ name => $field_name }); + my $search_field = Koha::SearchFields->find_or_create({ + name => $field_name, + label => $field_label, + type => $field_type, + }, + { + key => 'name' + }); $search_field->update( { - label => $field_label, - type => $field_type, facet_order => $facet_order } ); -- 2.11.0