328 |
|
|
329 |
# add database to arugemnts for output filter |
# add database to arugemnts for output filter |
330 |
$output->{database} = $database; |
$output->{database} = $database; |
331 |
|
$output->{clean} = $clean; |
332 |
|
|
333 |
$log->debug("calling $module->new(",dump( $output ),")"); |
$log->debug("calling $module->new(",dump( $output ),")"); |
334 |
my $out = new $module->new( $output ); |
my $out = new $module->new( $output ); |
490 |
); |
); |
491 |
} |
} |
492 |
|
|
493 |
my $rules = $parser->normalize_rules($database,$input_name) || $log->logdie("no normalize rules found for $database/$input_name"); |
my $rules = $parser->normalize_rules($database,$input_name); |
494 |
|
$log->logwarn("no normalize rules for $database/$input_name") unless $rules; |
495 |
|
|
496 |
$log->debug("parsed normalize rules:\n$rules"); |
$log->debug("parsed normalize rules:\n$rules"); |
497 |
|
|
498 |
# reset position in database |
# reset position in database |
562 |
next; # validation doesn't create any output |
next; # validation doesn't create any output |
563 |
} |
} |
564 |
|
|
565 |
my $ds = WebPAC::Normalize::data_structure( |
if ($rules) { |
566 |
row => $row, |
|
567 |
rules => $rules, |
my $ds = WebPAC::Normalize::data_structure( |
568 |
lookup => $lookup_hash, |
row => $row, |
569 |
config => create_ds_config( $db_config, $database, $input, $mfn ), |
rules => $rules, |
570 |
marc_encoding => 'utf-8', |
lookup => $lookup_hash, |
571 |
load_row_coderef => sub { |
config => create_ds_config( $db_config, $database, $input, $mfn ), |
572 |
my ($database,$input,$mfn) = @_; |
marc_encoding => 'utf-8', |
573 |
|
load_row_coderef => sub { |
574 |
|
my ($database,$input,$mfn) = @_; |
575 |
#warn "### load_row($database,$input,$mfn) from data_structure\n"; |
#warn "### load_row($database,$input,$mfn) from data_structure\n"; |
576 |
return $store->load_row( |
return $store->load_row( |
577 |
|
database => $database, |
578 |
|
input => $input, |
579 |
|
id => $mfn, |
580 |
|
); |
581 |
|
}, |
582 |
|
); |
583 |
|
|
584 |
|
$log->debug("ds = ", sub { dump($ds) }); |
585 |
|
|
586 |
|
if ( $ds ) { |
587 |
|
|
588 |
|
$store->save_ds( |
589 |
database => $database, |
database => $database, |
590 |
input => $input, |
input => $input_name, |
591 |
id => $mfn, |
id => $mfn, |
592 |
); |
ds => $ds, |
593 |
}, |
) if !$stats; |
|
); |
|
594 |
|
|
595 |
$log->debug("ds = ", sub { dump($ds) }); |
$indexer->add( |
596 |
|
id => "${input_name}/${mfn}", |
597 |
|
ds => $ds, |
598 |
|
type => $config->get($indexer_config)->{type}, |
599 |
|
) if $indexer; |
600 |
|
|
601 |
if ( $ds ) { |
foreach my $out ( @output_modules ) { |
602 |
|
$out->add( $mfn, $ds ) if $out->can('add'); |
603 |
$store->save_ds( |
} |
|
database => $database, |
|
|
input => $input_name, |
|
|
id => $mfn, |
|
|
ds => $ds, |
|
|
) if !$stats; |
|
|
|
|
|
$indexer->add( |
|
|
id => "${input_name}/${mfn}", |
|
|
ds => $ds, |
|
|
type => $config->get($indexer_config)->{type}, |
|
|
) if $indexer; |
|
604 |
|
|
605 |
foreach my $out ( @output_modules ) { |
} else { |
606 |
$out->add( $mfn, $ds ) if $out->can('add'); |
$log->warn("record $pos didn't produce any output after normalization rules!") unless $marc; |
607 |
} |
} |
|
|
|
|
} else { |
|
|
$log->warn("record $pos didn't produce any output after normalization rules!") unless $marc; |
|
608 |
} |
} |
609 |
|
|
610 |
if ($marc) { |
if ($marc) { |