From f1aeea6615855770ad20a15b9e1f3b51bec28e1c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 29 Sep 2016 12:03:22 +0100 Subject: [PATCH] Bug 14899: Add a reset option For developpers only at the moment, if you want to reset your mappings, you can hit: admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1 --- admin/searchengine/elasticsearch/mappings.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/admin/searchengine/elasticsearch/mappings.pl b/admin/searchengine/elasticsearch/mappings.pl index 5f7712d..7d63002 100755 --- a/admin/searchengine/elasticsearch/mappings.pl +++ b/admin/searchengine/elasticsearch/mappings.pl @@ -21,6 +21,7 @@ use C4::Koha; use C4::Output; use C4::Auth; +use Koha::SearchEngine::Elasticsearch; use Koha::SearchMarcMaps; use Koha::SearchFields; @@ -96,6 +97,14 @@ if ( $op eq 'edit' ) { $schema->storage->txn_commit; } } +elsif( $op eq 'reset' ) { + # TODO Move this feature to the interface + my $sure = $input->param('i_know_what_i_am_doing'); + if ( $sure ) { + Koha::SearchMarcMaps->search->delete; + Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings; + } +} my @indexes; -- 2.8.1