/[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 516 by dpavlin, Tue May 16 15:23:12 2006 UTC revision 529 by dpavlin, Mon May 22 19:34:45 2006 UTC
# Line 121  if ($stats) { Line 121  if ($stats) {
121  my $total_rows = 0;  my $total_rows = 0;
122  my $start_t = time();  my $start_t = time();
123    
124    my @links;
125    my $indexer;
126    
127  while (my ($database, $db_config) = each %{ $config->{databases} }) {  while (my ($database, $db_config) = each %{ $config->{databases} }) {
128    
129          my ($only_database,$only_input) = split(m#/#, $only_filter) if ($only_filter);          my ($only_database,$only_input) = split(m#/#, $only_filter) if ($only_filter);
130          next if ($only_database && $database !~ m/$only_database/i);          next if ($only_database && $database !~ m/$only_database/i);
131    
         my $indexer;  
   
132          if ($use_indexer) {          if ($use_indexer) {
133                  my $indexer_config = $config->{$use_indexer} || $log->logdie("can't find '$use_indexer' part in confguration");                  my $indexer_config = $config->{$use_indexer} || $log->logdie("can't find '$use_indexer' part in confguration");
134                  $indexer_config->{database} = $database;                  $indexer_config->{database} = $database;
# Line 202  while (my ($database, $db_config) = each Line 203  while (my ($database, $db_config) = each
203    
204                  my $lookup = new WebPAC::Lookup(                  my $lookup = new WebPAC::Lookup(
205                          lookup_file => $input->{lookup},                          lookup_file => $input->{lookup},
206                  );                  ) if ($input->{lookup});
207    
208                  my $input_module = $config->{webpac}->{inputs}->{$type};                  my $input_module = $config->{webpac}->{inputs}->{$type};
209    
210                  $log->info("working on input '$input->{name}' in $input->{path} [type: $input->{type}] using $input_module lookup '$input->{lookup}'");                  $log->info("working on input '$input->{name}' in $input->{path} [type: $input->{type}] using $input_module",
211                            $input->{lookup} ? "lookup '$input->{lookup}'" : ""
212                    );
213    
214                  my $input_db = new WebPAC::Input(                  my $input_db = new WebPAC::Input(
215                          module => $input_module,                          module => $input_module,
# Line 222  while (my ($database, $db_config) = each Line 225  while (my ($database, $db_config) = each
225                  my $maxmfn = $input_db->open(                  my $maxmfn = $input_db->open(
226                          path => $input->{path},                          path => $input->{path},
227                          code_page => $input->{encoding},        # database encoding                          code_page => $input->{encoding},        # database encoding
228                            %{ $input },
229                  );                  );
230    
231                  my $n = new WebPAC::Normalize::XML(                  my $n = new WebPAC::Normalize::XML(
232                  #       filter => { 'foo' => sub { shift } },                  #       filter => { 'foo' => sub { shift } },
233                          db => $db,                          db => $db,
234                          lookup_regex => $lookup->regex,                          lookup_regex => $lookup ? $lookup->regex : undef,
235                          lookup => $lookup,                          lookup => $lookup,
236                          prefix => $input->{name},                          prefix => $input->{name},
237                  );                  );
# Line 288  while (my ($database, $db_config) = each Line 292  while (my ($database, $db_config) = each
292                                  $ds = WebPAC::Normalize::Set::data_structure(                                  $ds = WebPAC::Normalize::Set::data_structure(
293                                          row => $row,                                          row => $row,
294                                          rules => $rules,                                          rules => $rules,
295                                          lookup => $lookup->lookup_hash,                                          lookup => $lookup ? $lookup->lookup_hash : undef,
296                                  );                                  );
297    
298                                  $db->save_ds(                                  $db->save_ds(
# Line 326  while (my ($database, $db_config) = each Line 330  while (my ($database, $db_config) = each
330          if (ref($db_config->{links}) eq 'ARRAY') {          if (ref($db_config->{links}) eq 'ARRAY') {
331                  foreach my $link (@{ $db_config->{links} }) {                  foreach my $link (@{ $db_config->{links} }) {
332                          if ($use_indexer eq 'hyperestraier') {                          if ($use_indexer eq 'hyperestraier') {
333                                  $log->info("adding link $database -> $link->{to} [$link->{credit}]");                                  $log->info("saving link $database -> $link->{to} [$link->{credit}]");
334                                  $indexer->add_link(                                  push @links, {
335                                          from => $database,                                          from => $database,
336                                          to => $link->{to},                                          to => $link->{to},
337                                          credit => $link->{credit},                                          credit => $link->{credit},
338                                  );                                  };
339                          } else {                          } else {
340                                  $log->warn("NOT IMPLEMENTED WITH $use_indexer: adding link $database -> $link->{to} [$link->{credit}]");                                  $log->warn("NOT IMPLEMENTED WITH $use_indexer: adding link $database -> $link->{to} [$link->{credit}]");
341                          }                          }
# Line 340  while (my ($database, $db_config) = each Line 344  while (my ($database, $db_config) = each
344    
345  }  }
346    
347    foreach my $link (@links) {
348            $log->info("adding link $link->{from} -> $link->{to} [$link->{credit}]");
349            $indexer->add_link( %{ $link } );
350    }

Legend:
Removed from v.516  
changed lines
  Added in v.529

  ViewVC Help
Powered by ViewVC 1.1.26