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

(-)a/Koha/SearchEngine/Elasticsearch.pm (+7 lines)
Lines 274-283 sub _elasticsearch_mapping_for_default { Link Here
274
    };
274
    };
275
}
275
}
276
276
277
=head2 reset_elasticsearch_mappings
278
279
Deletes all search mappings and adds the default search mappings
280
281
=cut
282
277
sub reset_elasticsearch_mappings {
283
sub reset_elasticsearch_mappings {
278
    my $mappings_yaml = C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/mappings.yaml';
284
    my $mappings_yaml = C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/mappings.yaml';
279
    my $indexes = LoadFile( $mappings_yaml );
285
    my $indexes = LoadFile( $mappings_yaml );
280
286
287
    Koha::SearchMarcMaps->search->delete;
281
    while ( my ( $index_name, $fields ) = each %$indexes ) {
288
    while ( my ( $index_name, $fields ) = each %$indexes ) {
282
        while ( my ( $field_name, $data ) = each %$fields ) {
289
        while ( my ( $field_name, $data ) = each %$fields ) {
283
            my $field_type = $data->{type};
290
            my $field_type = $data->{type};
(-)a/admin/searchengine/elasticsearch/mappings.pl (-2 lines)
Lines 101-107 elsif( $op eq 'reset' ) { Link Here
101
    # TODO Move this feature to the interface
101
    # TODO Move this feature to the interface
102
    my $sure = $input->param('i_know_what_i_am_doing');
102
    my $sure = $input->param('i_know_what_i_am_doing');
103
    if ( $sure ) {
103
    if ( $sure ) {
104
        Koha::SearchMarcMaps->search->delete;
105
        Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings;
104
        Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings;
106
    }
105
    }
107
}
106
}
108
- 

Return to bug 17885