542 |
} |
} |
543 |
|
|
544 |
my $rules = $parser->normalize_rules($database,$input_name); |
my $rules = $parser->normalize_rules($database,$input_name); |
545 |
$log->logwarn("no normalize rules for $database/$input_name") unless $rules; |
$log->logwarn("no normalize rules for $database/$input_name", $input_db->input_module->can('normalize') ? " using normalize from input module" : '') unless $rules; |
546 |
|
|
547 |
$log->debug("parsed normalize rules:\n$rules"); |
$log->debug("parsed normalize rules:\n$rules"); |
548 |
|
|
616 |
next; # validation doesn't create any output |
next; # validation doesn't create any output |
617 |
} |
} |
618 |
|
|
619 |
|
my $ds; |
620 |
|
|
621 |
if ($rules) { |
if ($rules) { |
622 |
|
|
623 |
my $ds = WebPAC::Normalize::data_structure( |
my $ds = WebPAC::Normalize::data_structure( |
637 |
}, |
}, |
638 |
); |
); |
639 |
|
|
640 |
$log->debug("ds = ", sub { dump($ds) }); |
} elsif ( $input_db->input_module->can('normalize') ) { |
641 |
|
$ds = $input_db->input_module->normalize( $mfn ); |
642 |
|
} |
643 |
|
|
644 |
if ( $ds ) { |
if ( $ds ) { |
645 |
|
$log->debug("ds = ", sub { dump($ds) }); |
646 |
|
|
647 |
$store->save_ds( |
$store->save_ds( |
648 |
database => $database, |
database => $database, |
649 |
input => $input_name, |
input => $input_name, |
650 |
id => $mfn, |
id => $mfn, |
651 |
ds => $ds, |
ds => $ds, |
652 |
) if !$stats; |
) if !$stats; |
653 |
|
|
654 |
$indexer->add( |
$indexer->add( |
655 |
id => "${input_name}/${mfn}", |
id => "${input_name}/${mfn}", |
656 |
ds => $ds, |
ds => $ds, |
657 |
type => $config->get($indexer_config)->{type}, |
type => $config->get($indexer_config)->{type}, |
658 |
) if $indexer; |
) if $indexer; |
659 |
|
|
660 |
foreach my $out ( @output_modules ) { |
foreach my $out ( @output_modules ) { |
661 |
$out->add( $mfn, $ds ) if $out->can('add'); |
$out->add( $mfn, $ds ) if $out->can('add'); |
|
} |
|
|
|
|
|
} else { |
|
|
$log->warn("record $pos didn't produce any output after normalization rules!") unless $marc; |
|
662 |
} |
} |
|
} |
|
663 |
|
|
664 |
|
} else { |
665 |
|
$log->warn("record $pos didn't produce any output after normalization rules!") unless $marc; |
666 |
|
} |
667 |
if ($marc) { |
if ($marc) { |
668 |
my $i = 0; |
my $i = 0; |
669 |
|
|