/[webpac2]/trunk/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 /trunk/run.pl

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

revision 493 by dpavlin, Sun May 14 13:42:48 2006 UTC revision 508 by dpavlin, Mon May 15 13:32:18 2006 UTC
# Line 52  path to YAML configuration file Line 52  path to YAML configuration file
52    
53  =item --force-set  =item --force-set
54    
55  force conversion C<normalize->path> in C<config.yml> from  force conversion C<< normalize->path >> in C<config.yml> from
56  C<.xml> to C<.pl>  C<.xml> to C<.pl>
57    
58    =item --stats
59    
60    dump statistics about used fields and subfields in each input
61    
62  =back  =back
63    
64  =cut  =cut
# Line 67  my $config = 'conf/config.yml'; Line 71  my $config = 'conf/config.yml';
71  my $debug = 0;  my $debug = 0;
72  my $only_db_name;  my $only_db_name;
73  my $force_set = 0;  my $force_set = 0;
74    my $stats = 0;
75    
76  GetOptions(  GetOptions(
77          "limit=i" => \$limit,          "limit=i" => \$limit,
# Line 77  GetOptions( Line 82  GetOptions(
82          "config" => \$config,          "config" => \$config,
83          "debug" => \$debug,          "debug" => \$debug,
84          "force-set" => \$force_set,          "force-set" => \$force_set,
85            "stats" => \$stats,
86  );  );
87    
88  $config = LoadFile($config);  $config = LoadFile($config);
# Line 104  while (my ($database, $db_config) = each Line 110  while (my ($database, $db_config) = each
110          $indexer_config->{clean} = $clean;          $indexer_config->{clean} = $clean;
111          $indexer_config->{label} = $db_config->{name};          $indexer_config->{label} = $db_config->{name};
112    
         # important: clean database just once!  
         $clean = 0;  
   
113          if ($use_indexer eq 'hyperestraier') {          if ($use_indexer eq 'hyperestraier') {
114    
115                  # open Hyper Estraier database                  # open Hyper Estraier database
# Line 184  while (my ($database, $db_config) = each Line 187  while (my ($database, $db_config) = each
187                          offset => $offset,                          offset => $offset,
188                          lookup => $lookup,                          lookup => $lookup,
189                          recode => $input->{recode},                          recode => $input->{recode},
190                            stats => $stats,
191                  );                  );
192                  $log->logdie("can't create input using $input_module") unless ($input);                  $log->logdie("can't create input using $input_module") unless ($input);
193    
# Line 242  while (my ($database, $db_config) = each Line 246  while (my ($database, $db_config) = each
246                                  push @{ $row->{'000'} }, $pos;                                  push @{ $row->{'000'} }, $pos;
247                          }                          }
248    
249                          my $ds = $n ? $n->data_structure($row) :                                  
250                                  WebPAC::Normalize::Set::data_structure(                          my $ds;
251                            if ($n) {
252                                    $ds = $n->data_structure($row);
253                            } else {
254                                    $ds = WebPAC::Normalize::Set::data_structure(
255                                          row => $row,                                          row => $row,
256                                          rules => $rules,                                          rules => $rules,
257                                          lookup => $lookup->lookup_hash,                                          lookup => $lookup->lookup_hash,
258                                  );                                  );
259    
260                                    $db->save_ds(
261                                            id => $mfn,
262                                            ds => $ds,
263                                            prefix => $input->{name},
264                                    ) if ($ds);
265                            }
266    
267                          $indexer->add(                          $indexer->add(
268                                  id => $input->{name} . "/" . $mfn,                                  id => $input->{name} . "/" . $mfn,
269                                  ds => $ds,                                  ds => $ds,
# Line 258  while (my ($database, $db_config) = each Line 273  while (my ($database, $db_config) = each
273                          $total_rows++;                          $total_rows++;
274                  }                  }
275    
276                    $log->info("statistics of fields usage:\n", $input_db->stats) if ($stats);
277    
278          };          };
279    
280          eval { $indexer->finish } if ($indexer->can('finish'));          eval { $indexer->finish } if ($indexer->can('finish'));

Legend:
Removed from v.493  
changed lines
  Added in v.508

  ViewVC Help
Powered by ViewVC 1.1.26