From 450fbad7512b01da1ec4300b8443210281e6e3d3 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 Signed-off-by: Nick Clemens --- 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.39.5