55 |
force conversion C<normalize->path> in C<config.yml> from |
force conversion C<normalize->path> in C<config.yml> from |
56 |
C<.xml> to C<.pl> |
C<.xml> to C<.pl> |
57 |
|
|
58 |
|
=item --stats |
59 |
|
|
60 |
|
dump statistics about used fields and subfields in each input |
61 |
|
|
62 |
=back |
=back |
63 |
|
|
64 |
=cut |
=cut |
71 |
my $debug = 0; |
my $debug = 0; |
72 |
my $only_db_name; |
my $only_db_name; |
73 |
my $force_set = 0; |
my $force_set = 0; |
74 |
|
my $stats = 0; |
75 |
|
|
76 |
GetOptions( |
GetOptions( |
77 |
"limit=i" => \$limit, |
"limit=i" => \$limit, |
82 |
"config" => \$config, |
"config" => \$config, |
83 |
"debug" => \$debug, |
"debug" => \$debug, |
84 |
"force-set" => \$force_set, |
"force-set" => \$force_set, |
85 |
|
"stats" => \$stats, |
86 |
); |
); |
87 |
|
|
88 |
$config = LoadFile($config); |
$config = LoadFile($config); |
110 |
$indexer_config->{clean} = $clean; |
$indexer_config->{clean} = $clean; |
111 |
$indexer_config->{label} = $db_config->{name}; |
$indexer_config->{label} = $db_config->{name}; |
112 |
|
|
|
# important: clean database just once! |
|
|
$clean = 0; |
|
|
|
|
113 |
if ($use_indexer eq 'hyperestraier') { |
if ($use_indexer eq 'hyperestraier') { |
114 |
|
|
115 |
# open Hyper Estraier database |
# open Hyper Estraier database |
187 |
offset => $offset, |
offset => $offset, |
188 |
lookup => $lookup, |
lookup => $lookup, |
189 |
recode => $input->{recode}, |
recode => $input->{recode}, |
190 |
|
stats => $stats, |
191 |
); |
); |
192 |
$log->logdie("can't create input using $input_module") unless ($input); |
$log->logdie("can't create input using $input_module") unless ($input); |
193 |
|
|
211 |
my $new_norm_path = $normalize_path; |
my $new_norm_path = $normalize_path; |
212 |
$new_norm_path =~ s/\.xml$/.pl/; |
$new_norm_path =~ s/\.xml$/.pl/; |
213 |
if (-e $new_norm_path) { |
if (-e $new_norm_path) { |
214 |
$log->info("--force-set replaced $normalize_path with $new_norm_path"); |
$log->debug("--force-set replaced $normalize_path with $new_norm_path"); |
215 |
$normalize_path = $new_norm_path; |
$normalize_path = $new_norm_path; |
216 |
} else { |
} else { |
217 |
$log->warn("--force-set failed on $new_norm_path, fallback to $normalize_path"); |
$log->debug("--force-set failed on $new_norm_path, fallback to $normalize_path"); |
218 |
} |
} |
219 |
} |
} |
220 |
|
|
262 |
$total_rows++; |
$total_rows++; |
263 |
} |
} |
264 |
|
|
265 |
|
$log->info("statistics of fields usage:\n", $input_db->stats) if ($stats); |
266 |
|
|
267 |
}; |
}; |
268 |
|
|
269 |
eval { $indexer->finish } if ($indexer->can('finish')); |
eval { $indexer->finish } if ($indexer->can('finish')); |