Lines 22-27
use C4::Output;
Link Here
|
22 |
use C4::Auth; |
22 |
use C4::Auth; |
23 |
|
23 |
|
24 |
use Koha::SearchEngine::Elasticsearch; |
24 |
use Koha::SearchEngine::Elasticsearch; |
|
|
25 |
use Koha::SearchEngine::Elasticsearch::Indexer; |
25 |
use Koha::SearchMarcMaps; |
26 |
use Koha::SearchMarcMaps; |
26 |
use Koha::SearchFields; |
27 |
use Koha::SearchFields; |
27 |
|
28 |
|
Lines 37-42
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
37 |
|
38 |
|
38 |
my $index = $input->param('index') || 'biblios'; |
39 |
my $index = $input->param('index') || 'biblios'; |
39 |
my $op = $input->param('op') || 'list'; |
40 |
my $op = $input->param('op') || 'list'; |
|
|
41 |
my $action = $input->param('action') || ''; |
40 |
my @messages; |
42 |
my @messages; |
41 |
|
43 |
|
42 |
my $database = Koha::Database->new(); |
44 |
my $database = Koha::Database->new(); |
Lines 97-108
if ( $op eq 'edit' ) {
Link Here
|
97 |
$schema->storage->txn_commit; |
99 |
$schema->storage->txn_commit; |
98 |
} |
100 |
} |
99 |
} |
101 |
} |
100 |
elsif( $op eq 'reset' ) { |
102 |
elsif( $op eq 'admin') { |
101 |
# TODO Move this feature to the interface |
103 |
if( $input->param('admin_password') eq C4::Context->config('elasticsearch_admin_password') ){ |
102 |
my $sure = $input->param('i_know_what_i_am_doing'); |
104 |
if ( $action eq 'reset' ) { |
103 |
if ( $sure ) { |
105 |
Koha::SearchMarcMaps->search->delete; |
104 |
Koha::SearchMarcMaps->search->delete; |
106 |
Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings; |
105 |
Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings; |
107 |
$template->param( mappings_reset => 1 ); |
|
|
108 |
} |
109 |
elsif ( $action eq 'reindex' ) { |
110 |
my $reindex_bibs = Koha::SearchEngine::Elasticsearch::Indexer->new({ index => 'biblios' })->do_reindex( undef, undef, 0, [] ); |
111 |
my $reindex_auths = Koha::SearchEngine::Elasticsearch::Indexer->new({ index => 'authorities' })->do_reindex( undef, undef, 0, [] ); |
112 |
$template->param( reindex_launched => 1 ); |
113 |
} |
114 |
} |
115 |
else { |
116 |
$template->param( admin_badpassword => 1 ); |
106 |
} |
117 |
} |
107 |
} |
118 |
} |
108 |
|
119 |
|
Lines 139-144
$template->param(
Link Here
|
139 |
indexes => \@indexes, |
150 |
indexes => \@indexes, |
140 |
all_search_fields => \@all_search_fields, |
151 |
all_search_fields => \@all_search_fields, |
141 |
messages => \@messages, |
152 |
messages => \@messages, |
|
|
153 |
show_admin_options => C4::Context->config('elasticsearch_admin_password') ? 1 : 0, |
142 |
); |
154 |
); |
143 |
|
155 |
|
144 |
output_html_with_http_headers $input, $cookie, $template->output; |
156 |
output_html_with_http_headers $input, $cookie, $template->output; |