View | Details | Raw Unified | Return to bug 19482
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch.pm (-3 / +10 lines)
Lines 294-302 sub reset_elasticsearch_mappings { Link Here
294
            my $field_type = $data->{type};
294
            my $field_type = $data->{type};
295
            my $field_label = $data->{label};
295
            my $field_label = $data->{label};
296
            my $field_mandatory = $data->{mandatory};
296
            my $field_mandatory = $data->{mandatory};
297
            warn $field_mandatory;
298
            my $mappings = $data->{mappings};
297
            my $mappings = $data->{mappings};
299
            my $search_field = Koha::SearchFields->find_or_create({ name => $field_name, label => $field_label, type => $field_type, mandatory => $field_mandatory }, { key => 'name' });
298
            my $search_field = Koha::SearchFields->find({ name => $field_name });
299
            if( $search_field ){
300
                $search_field->type($field_type);
301
                $search_field->label($field_label);
302
                $search_field->mandatory($field_mandatory);
303
                $search_field->store;
304
            } else {
305
                $search_field = Koha::SearchFields->new({ name => $field_name, label => $field_label, type => $field_type, mandatory => $field_mandatory });
306
                $search_field->store;
307
            }
300
            for my $mapping ( @$mappings ) {
308
            for my $mapping ( @$mappings ) {
301
                my $marc_field = Koha::SearchMarcMaps->find_or_create({ index_name => $index_name, marc_type => $mapping->{marc_type}, marc_field => $mapping->{marc_field} });
309
                my $marc_field = Koha::SearchMarcMaps->find_or_create({ index_name => $index_name, marc_type => $mapping->{marc_type}, marc_field => $mapping->{marc_field} });
302
                $search_field->add_to_search_marc_maps($marc_field, { facet => $mapping->{facet} || 0, suggestible => $mapping->{suggestible} || 0, sort => $mapping->{sort} } );
310
                $search_field->add_to_search_marc_maps($marc_field, { facet => $mapping->{facet} || 0, suggestible => $mapping->{suggestible} || 0, sort => $mapping->{sort} } );
303
- 

Return to bug 19482