17 |
use YAML qw/LoadFile/; |
use YAML qw/LoadFile/; |
18 |
use Getopt::Long; |
use Getopt::Long; |
19 |
use File::Path; |
use File::Path; |
20 |
|
use Time::HiRes qw/time/; |
21 |
|
|
22 |
=head1 NAME |
=head1 NAME |
23 |
|
|
41 |
|
|
42 |
remove database and Hyper Estraier index before indexing |
remove database and Hyper Estraier index before indexing |
43 |
|
|
44 |
|
=item --one=database_name |
45 |
|
|
46 |
|
reindex just single database |
47 |
|
|
48 |
=item --config conf/config.yml |
=item --config conf/config.yml |
49 |
|
|
50 |
path to YAML configuration file |
path to YAML configuration file |
59 |
my $clean = 0; |
my $clean = 0; |
60 |
my $config = 'conf/config.yml'; |
my $config = 'conf/config.yml'; |
61 |
my $debug = 0; |
my $debug = 0; |
62 |
|
my $one_db_name; |
63 |
|
|
64 |
GetOptions( |
GetOptions( |
65 |
"limit=i" => \$limit, |
"limit=i" => \$limit, |
66 |
"offset=i" => \$offset, |
"offset=i" => \$offset, |
67 |
"clean" => \$clean, |
"clean" => \$clean, |
68 |
|
"one=s" => \$one_db_name, |
69 |
"config" => \$config, |
"config" => \$config, |
70 |
"debug" => \$debug, |
"debug" => \$debug, |
71 |
); |
); |
77 |
die "no databases in config file!\n" unless ($config->{databases}); |
die "no databases in config file!\n" unless ($config->{databases}); |
78 |
|
|
79 |
my $total_rows = 0; |
my $total_rows = 0; |
80 |
|
my $start_t = time(); |
81 |
|
|
82 |
while (my ($database, $db_config) = each %{ $config->{databases} }) { |
while (my ($database, $db_config) = each %{ $config->{databases} }) { |
83 |
|
|
84 |
|
next if ($one_db_name && $database !~ m/$one_db_name/i); |
85 |
|
|
86 |
my $log = _new WebPAC::Common()->_get_logger(); |
my $log = _new WebPAC::Common()->_get_logger(); |
87 |
|
|
88 |
# |
# |
207 |
|
|
208 |
}; |
}; |
209 |
|
|
210 |
$log->info("$total_rows records indexed"); |
my $dt = time() - $start_t; |
211 |
|
$log->info("$total_rows records indexed in " . |
212 |
|
sprintf("%.2f sec [%.2f rec/sec]", |
213 |
|
$dt, ($total_rows / $dt) |
214 |
|
) |
215 |
|
); |
216 |
|
|
217 |
# |
# |
218 |
# add Hyper Estraier links to other databases |
# add Hyper Estraier links to other databases |