13 |
use WebPAC::Store 0.03; |
use WebPAC::Store 0.03; |
14 |
use WebPAC::Normalize::XML; |
use WebPAC::Normalize::XML; |
15 |
use WebPAC::Output::TT; |
use WebPAC::Output::TT; |
16 |
use WebPAC::Output::Estraier 0.05; |
use WebPAC::Output::Estraier 0.08; |
17 |
use YAML qw/LoadFile/; |
use YAML qw/LoadFile/; |
18 |
use Getopt::Long; |
use Getopt::Long; |
19 |
use File::Path; |
use File::Path; |
40 |
|
|
41 |
remove database and Hyper Estraier index before indexing |
remove database and Hyper Estraier index before indexing |
42 |
|
|
43 |
|
=item --one=database_name |
44 |
|
|
45 |
|
reindex just single database |
46 |
|
|
47 |
=item --config conf/config.yml |
=item --config conf/config.yml |
48 |
|
|
49 |
path to YAML configuration file |
path to YAML configuration file |
58 |
my $clean = 0; |
my $clean = 0; |
59 |
my $config = 'conf/config.yml'; |
my $config = 'conf/config.yml'; |
60 |
my $debug = 0; |
my $debug = 0; |
61 |
|
my $one_db_name; |
62 |
|
|
63 |
GetOptions( |
GetOptions( |
64 |
"limit=i" => \$limit, |
"limit=i" => \$limit, |
65 |
"offset=i" => \$offset, |
"offset=i" => \$offset, |
66 |
"clean" => \$clean, |
"clean" => \$clean, |
67 |
|
"one=s" => \$one_db_name, |
68 |
"config" => \$config, |
"config" => \$config, |
69 |
"debug" => \$debug, |
"debug" => \$debug, |
70 |
); |
); |
79 |
|
|
80 |
while (my ($database, $db_config) = each %{ $config->{databases} }) { |
while (my ($database, $db_config) = each %{ $config->{databases} }) { |
81 |
|
|
82 |
|
next if ($one_db_name && $database !~ m/$one_db_name/i); |
83 |
|
|
84 |
my $log = _new WebPAC::Common()->_get_logger(); |
my $log = _new WebPAC::Common()->_get_logger(); |
85 |
|
|
86 |
# |
# |
89 |
|
|
90 |
my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration"); |
my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration"); |
91 |
$est_config->{database} = $database; |
$est_config->{database} = $database; |
92 |
|
$est_config->{clean} = $clean; |
93 |
|
|
94 |
my $est = new WebPAC::Output::Estraier( |
my $est = new WebPAC::Output::Estraier( %{ $est_config } ); |
|
%{ $est_config }, |
|
|
); |
|
|
|
|
|
if ($clean) { |
|
|
$log->warn("creating new empty index $database"); |
|
|
$est->master( action => 'nodedel', name => $database ); |
|
|
$est->master( action => 'nodeadd', name => $database, label => $database ); |
|
|
} |
|
95 |
|
|
96 |
# |
# |
97 |
# now WebPAC::Store |
# now WebPAC::Store |