Bugzilla – Attachment 69250 Details for
Bug 19482
Elasticsearch - prevent removal / editing of required indexes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19482 - Make reset mappings reset also reset fields
Bug-19482---Make-reset-mappings-reset-also-reset-f.patch (text/plain), 2.10 KB, created by
Nick Clemens (kidclamp)
on 2017-11-21 15:26:28 UTC
(
hide
)
Description:
Bug 19482 - Make reset mappings reset also reset fields
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-11-21 15:26:28 UTC
Size:
2.10 KB
patch
obsolete
>From e1aaadb25b34b1162b5559df7db7ecd11dd2e7a5 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 17 Nov 2017 18:33:34 +0000 >Subject: [PATCH] Bug 19482 - Make reset mappings reset also reset fields > >I think this makes sense, we should reset to the mappings file >completely > >To test: >1 - Change a field label in es >2 - Save it >3 - Reset mapping >4 - Label should be reset >--- > Koha/SearchEngine/Elasticsearch.pm | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index cb8ecaa..ca7e8e6 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -294,9 +294,17 @@ sub reset_elasticsearch_mappings { > my $field_type = $data->{type}; > my $field_label = $data->{label}; > my $field_mandatory = $data->{mandatory}; >- warn $field_mandatory; > my $mappings = $data->{mappings}; >- my $search_field = Koha::SearchFields->find_or_create({ name => $field_name, label => $field_label, type => $field_type, mandatory => $field_mandatory }, { key => 'name' }); >+ my $search_field = Koha::SearchFields->find({ name => $field_name }); >+ if( $search_field ){ >+ $search_field->type($field_type); >+ $search_field->label($field_label); >+ $search_field->mandatory($field_mandatory); >+ $search_field->store; >+ } else { >+ $search_field = Koha::SearchFields->new({ name => $field_name, label => $field_label, type => $field_type, mandatory => $field_mandatory }); >+ $search_field->store; >+ } > for my $mapping ( @$mappings ) { > my $marc_field = Koha::SearchMarcMaps->find_or_create({ index_name => $index_name, marc_type => $mapping->{marc_type}, marc_field => $mapping->{marc_field} }); > $search_field->add_to_search_marc_maps($marc_field, { facet => $mapping->{facet} || 0, suggestible => $mapping->{suggestible} || 0, sort => $mapping->{sort} } ); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19482
:
68246
|
68247
|
68248
|
69250
|
72846
|
72847
|
72848
|
72878
|
72879
|
72880
|
77007
|
77008
|
77009
|
77010
|
80817
|
80818
|
80819
|
80820
|
93366
|
93367
|
93368
|
93371
|
93372
|
93373
|
97226
|
97227
|
97228
|
101312
|
101313
|
101314
|
108467
|
108468
|
108469
|
108470
|
108471
|
111923
|
111924
|
111925
|
111926
|
111927
|
111929
|
112456
|
112459
|
112460
|
112461
|
112462
|
112463
|
112464
|
112465