--- trunk/run.pl 2006/06/29 23:19:26 547 +++ trunk/run.pl 2006/06/30 20:43:18 552 @@ -63,6 +63,14 @@ turn on extra validation of imput records, see L +=item --marc-normalize conf/normalize/mapping.pl + +This option specifies normalisation file for MARC creation + +=item --marc-output out/marc/test.marc + +Optional path to output file + =back =cut @@ -76,6 +84,7 @@ my $only_filter; my $stats = 0; my $validate_path; +my ($marc_normalize, $marc_output); GetOptions( "limit=i" => \$limit, @@ -87,6 +96,8 @@ "debug" => \$debug, "stats" => \$stats, "validate=s" => \$validate_path, + "marc-normalize=s" => \$marc_normalize, + "marc-output=s" => \$marc_output, ); $config = LoadFile($config); @@ -111,6 +122,9 @@ $log->info("using $use_indexer indexing engine..."); } +# disable indexing when creating marc +$use_indexer = undef if ($marc_normalize); + my $total_rows = 0; my $start_t = time(); @@ -224,6 +238,13 @@ my @norm_array = ref($input->{normalize}) eq 'ARRAY' ? @{ $input->{normalize} } : ( $input->{normalize} ); + if ($marc_normalize) { + @norm_array = ( { + path => $marc_normalize, + output => $marc_output || 'out/marc/' . $database . '-' . $input->{name} . '.marc', + } ); + } + foreach my $normalize (@norm_array) { my $normalize_path = $normalize->{path} || $log->logdie("can't find normalize path in config"); @@ -235,7 +256,7 @@ $log->info("Using $normalize_path for normalization..."); my $marc_fh; - if (my $path = $normalize->{marc21}) { + if (my $path = $normalize->{output}) { open($marc_fh, '>', $path) || $log->logdie("can't open MARC output $path: $!"); @@ -314,7 +335,7 @@ # # add Hyper Estraier links to other databases # - if (ref($db_config->{links}) eq 'ARRAY') { + if (ref($db_config->{links}) eq 'ARRAY' && $use_indexer) { foreach my $link (@{ $db_config->{links} }) { if ($use_indexer eq 'hyperestraier') { $log->info("saving link $database -> $link->{to} [$link->{credit}]");