diff --git a/do_all_you_can_do.pl b/do_all_you_can_do.pl index 6867ffd..4cedb1f 100644 --- a/do_all_you_can_do.pl +++ b/do_all_you_can_do.pl @@ -23,11 +23,15 @@ my $instance; my $userid; my $password; +my $koha_dir; +my $elasticsearch; GetOptions( + 'elasticsearch' => \$elasticsearch, 'instance=s' => \$instance, - 'userid=s' => \$userid, - 'password=s' => \$password + 'koha_dir=s' => \$koha_dir, + 'password=s' => \$password, + 'userid=s' => \$userid ); my $create_superlibrarian_opts = ""; @@ -38,6 +42,7 @@ $instance //= 'kohadev'; +$koha_dir //= '/home/vagrant/kohaclone'; my $misc_dir = dirname( abs_path( $0 ) ); my ( $cmd, $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ); @@ -61,6 +66,11 @@ $cmd = "sudo koha-rebuild-zebra -f -v $instance"; ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 1 ); exit(1) unless $success; -# TODO Add rebuild ES + +if ($elasticsearch) { + $cmd = "sudo koha-shell $instance -p -c 'PERL5LIB=$PERL5LIB perl $koha_dir/misc/search_tools/rebuild_elastic_search.pl -v'"; + ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 1 ); + exit(1) unless $success; +} exit(0); diff --git a/populate_db.pl b/populate_db.pl index f90262e..8a4743c 100755 --- a/populate_db.pl +++ b/populate_db.pl @@ -21,7 +21,7 @@ use C4::Installer; use C4::Context; -#use Koha::SearchEngine::Elasticsearch; +use Koha::SearchEngine::Elasticsearch; =head1 NAME @@ -170,7 +170,7 @@ sub initialize_data { }); # Initialize ES mappings - #Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings; + Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings; } sub execute_sqlfile {