/[webpac2]/branches/Sack/run.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/Sack/run.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/run.pl revision 1185 by dpavlin, Tue May 19 11:55:30 2009 UTC branches/Sack/run.pl revision 1310 by dpavlin, Mon Sep 21 19:04:14 2009 UTC
# Line 383  foreach my $database ( sort keys %{ $con Line 383  foreach my $database ( sort keys %{ $con
383                          next;                          next;
384                  }                  }
385    
386                  next if ($only_input && ($input_name !~ m#$only_input#i && $input->{type} !~ m#$only_input#i));                  next if defined $only_input && $input_name !~ m#$only_input#i;
387    
388                  my $type = lc($input->{type});                  my $type = lc($input->{type});
389    
# Line 542  foreach my $database ( sort keys %{ $con Line 542  foreach my $database ( sort keys %{ $con
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;                  if ( ! $rules ) {
546                            $log->logwarn("no normalize rules for $database/$input_name", $input_db->input_module->can('normalize') ? " using normalize from input module" : '');
547                            next;
548                    }
549    
550                  $log->debug("parsed normalize rules:\n$rules");                  $log->debug("parsed normalize rules:\n$rules");
551    
# Line 603  foreach my $database ( sort keys %{ $con Line 606  foreach my $database ( sort keys %{ $con
606                                  push @{ $row->{'000'} }, $pos;                                  push @{ $row->{'000'} }, $pos;
607                          }                          }
608    
609                            foreach my $out ( @output_modules ) {
610                                    $out->add_row( $mfn, $row ) if $out->can('add_row');
611                            }
612    
613                          if ($validate) {                          if ($validate) {
614                                  if ( my $errors = $validate->validate_rec( $row, $input_db->dump_ascii ) ) {                                  if ( my $errors = $validate->validate_rec( $row, $input_db->dump_ascii ) ) {
# Line 613  foreach my $database ( sort keys %{ $con Line 619  foreach my $database ( sort keys %{ $con
619                                  next;   # validation doesn't create any output                                  next;   # validation doesn't create any output
620                          }                          }
621    
622                            my $ds;
623    
624                          if ($rules) {                          if ($rules) {
625    
626                                  my $ds = WebPAC::Normalize::data_structure(                                  $ds = WebPAC::Normalize::data_structure(
627                                          row => $row,                                          row => $row,
628                                          rules => $rules,                                          rules => $rules,
629                                          lookup => $lookup_hash,                                          lookup => $lookup_hash,
# Line 632  foreach my $database ( sort keys %{ $con Line 640  foreach my $database ( sort keys %{ $con
640                                          },                                          },
641                                  );                                  );
642    
643                                  $log->debug("ds = ", sub { dump($ds) });                          } elsif ( $input_db->input_module->can('normalize') ) {
644                                    $ds = $input_db->input_module->normalize( $mfn );
645                                  if ( $ds ) {                          }
646    
647                                          $store->save_ds(                          if ( $ds ) {
648                                                  database => $database,                                  $log->debug("ds = ", sub { dump($ds) });
                                                 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;  
649    
650                                          foreach my $out ( @output_modules ) {                                  $store->save_ds(
651                                                  $out->add( $mfn, $ds ) if $out->can('add');                                          database => $database,
652                                          }                                          input => $input_name,
653                                            id => $mfn,
654                                            ds => $ds,
655                                    ) if !$stats;
656    
657                                    $indexer->add(
658                                            id => "${input_name}/${mfn}",
659                                            ds => $ds,
660                                            type => $config->get($indexer_config)->{type},
661                                    ) if $indexer;
662    
663                                  } else {                                  foreach my $out ( @output_modules ) {
664                                          $log->warn("record $pos didn't produce any output after normalization rules!") unless $marc;                                          $out->add( $mfn, $ds ) if $out->can('add');
665                                  }                                  }
                         }  
666    
667                            } else {
668                                    $log->warn("record $pos didn't produce any output after normalization rules!") unless $marc;
669                            }
670                          if ($marc) {                          if ($marc) {
671                                  my $i = 0;                                  my $i = 0;
672    

Legend:
Removed from v.1185  
changed lines
  Added in v.1310

  ViewVC Help
Powered by ViewVC 1.1.26