From bc41b29b6437445c35b71fe4fc623506e3cf6fbf 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 Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall Signed-off-by: Brendan Gallagher --- 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 5f7712d2a0..7d63002919 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.39.5