121 |
my $total_rows = 0; |
my $total_rows = 0; |
122 |
my $start_t = time(); |
my $start_t = time(); |
123 |
|
|
124 |
|
my @links; |
125 |
|
my $indexer; |
126 |
|
|
127 |
while (my ($database, $db_config) = each %{ $config->{databases} }) { |
while (my ($database, $db_config) = each %{ $config->{databases} }) { |
128 |
|
|
129 |
my ($only_database,$only_input) = split(m#/#, $only_filter) if ($only_filter); |
my ($only_database,$only_input) = split(m#/#, $only_filter) if ($only_filter); |
130 |
next if ($only_database && $database !~ m/$only_database/i); |
next if ($only_database && $database !~ m/$only_database/i); |
131 |
|
|
|
my $indexer; |
|
|
|
|
132 |
if ($use_indexer) { |
if ($use_indexer) { |
133 |
my $indexer_config = $config->{$use_indexer} || $log->logdie("can't find '$use_indexer' part in confguration"); |
my $indexer_config = $config->{$use_indexer} || $log->logdie("can't find '$use_indexer' part in confguration"); |
134 |
$indexer_config->{database} = $database; |
$indexer_config->{database} = $database; |
207 |
|
|
208 |
my $input_module = $config->{webpac}->{inputs}->{$type}; |
my $input_module = $config->{webpac}->{inputs}->{$type}; |
209 |
|
|
210 |
$log->info("working on input '$input->{name}' in $input->{path} [type: $input->{type}] using $input_module lookup '$input->{lookup}'"); |
$log->info("working on input '$input->{name}' in $input->{path} [type: $input->{type}] using $input_module", |
211 |
|
$input->{lookup} ? "lookup '$input->{lookup}'" : "" |
212 |
|
); |
213 |
|
|
214 |
my $input_db = new WebPAC::Input( |
my $input_db = new WebPAC::Input( |
215 |
module => $input_module, |
module => $input_module, |
225 |
my $maxmfn = $input_db->open( |
my $maxmfn = $input_db->open( |
226 |
path => $input->{path}, |
path => $input->{path}, |
227 |
code_page => $input->{encoding}, # database encoding |
code_page => $input->{encoding}, # database encoding |
228 |
|
%{ $input }, |
229 |
); |
); |
230 |
|
|
231 |
my $n = new WebPAC::Normalize::XML( |
my $n = new WebPAC::Normalize::XML( |
330 |
if (ref($db_config->{links}) eq 'ARRAY') { |
if (ref($db_config->{links}) eq 'ARRAY') { |
331 |
foreach my $link (@{ $db_config->{links} }) { |
foreach my $link (@{ $db_config->{links} }) { |
332 |
if ($use_indexer eq 'hyperestraier') { |
if ($use_indexer eq 'hyperestraier') { |
333 |
$log->info("adding link $database -> $link->{to} [$link->{credit}]"); |
$log->info("saving link $database -> $link->{to} [$link->{credit}]"); |
334 |
$indexer->add_link( |
push @links, { |
335 |
from => $database, |
from => $database, |
336 |
to => $link->{to}, |
to => $link->{to}, |
337 |
credit => $link->{credit}, |
credit => $link->{credit}, |
338 |
); |
}; |
339 |
} else { |
} else { |
340 |
$log->warn("NOT IMPLEMENTED WITH $use_indexer: adding link $database -> $link->{to} [$link->{credit}]"); |
$log->warn("NOT IMPLEMENTED WITH $use_indexer: adding link $database -> $link->{to} [$link->{credit}]"); |
341 |
} |
} |
344 |
|
|
345 |
} |
} |
346 |
|
|
347 |
|
foreach my $link (@links) { |
348 |
|
$log->info("adding link $link->{from} -> $link->{to} [$link->{credit}]"); |
349 |
|
$indexer->add_link( %{ $link } ); |
350 |
|
} |