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

(-)a/Koha/SearchEngine/Elasticsearch.pm (+7 lines)
Lines 275-284 sub _elasticsearch_mapping_for_default { Link Here
275
    };
275
    };
276
}
276
}
277
277
278
=head2 reset_elasticsearch_mappings
279
280
Deletes all search mappings and adds the default search mappings
281
282
=cut
283
278
sub reset_elasticsearch_mappings {
284
sub reset_elasticsearch_mappings {
279
    my $mappings_yaml = C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/mappings.yaml';
285
    my $mappings_yaml = C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/mappings.yaml';
280
    my $indexes = LoadFile( $mappings_yaml );
286
    my $indexes = LoadFile( $mappings_yaml );
281
287
288
    Koha::SearchMarcMaps->search->delete;
282
    while ( my ( $index_name, $fields ) = each %$indexes ) {
289
    while ( my ( $index_name, $fields ) = each %$indexes ) {
283
        while ( my ( $field_name, $data ) = each %$fields ) {
290
        while ( my ( $field_name, $data ) = each %$fields ) {
284
            my $field_type = $data->{type};
291
            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