/[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 430 by dpavlin, Mon Apr 17 15:09:54 2006 UTC revision 434 by dpavlin, Mon Apr 17 16:50:53 2006 UTC
# Line 75  $config = LoadFile($config); Line 75  $config = LoadFile($config);
75  print "config = ",Dumper($config) if ($debug);  print "config = ",Dumper($config) if ($debug);
76    
77  die "no databases in config file!\n" unless ($config->{databases});  die "no databases in config file!\n" unless ($config->{databases});
78    
79    my $log = _new WebPAC::Common()->_get_logger();
80    
81  my $use_indexer = $config->{use_indexer} || 'hyperestraier';  my $use_indexer = $config->{use_indexer} || 'hyperestraier';
82    $log->info("using $use_indexer indexing engine...");
83    
84  my $total_rows = 0;  my $total_rows = 0;
85  my $start_t = time();  my $start_t = time();
# Line 84  while (my ($database, $db_config) = each Line 88  while (my ($database, $db_config) = each
88    
89          next if ($only_db_name && $database !~ m/$only_db_name/i);          next if ($only_db_name && $database !~ m/$only_db_name/i);
90    
         my $log = _new WebPAC::Common()->_get_logger();  
   
91          my $indexer;          my $indexer;
92    
93            my $indexer_config = $config->{$use_indexer} || $log->logdie("can't find '$use_indexer' part in confguration");
94            $indexer_config->{database} = $database;
95            $indexer_config->{clean} = $clean;
96            $indexer_config->{label} = $db_config->{name};
97    
98            # important: clean database just once!
99            $clean = 0;
100    
101          if ($use_indexer eq 'hyperestraier') {          if ($use_indexer eq 'hyperestraier') {
102    
                 #  
103                  # open Hyper Estraier database                  # open Hyper Estraier database
                 #  
   
104                  use WebPAC::Output::Estraier '0.10';                  use WebPAC::Output::Estraier '0.10';
105                  my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration");                  $indexer = new WebPAC::Output::Estraier( %{ $indexer_config } );
106                  $est_config->{database} = $database;          
107                  $est_config->{clean} = $clean;          } elsif ($use_indexer eq 'kinosearch') {
108                  $est_config->{label} = $db_config->{name};  
109                    # open KinoSearch
110                    use WebPAC::Output::KinoSearch;
111                    $indexer_config->{clean} = 1 unless (-e $indexer_config->{index_path});
112                    $indexer = new WebPAC::Output::KinoSearch( %{ $indexer_config } );
113    
                 $indexer = new WebPAC::Output::Estraier( %{ $est_config } );  
114          } else {          } else {
115                  $log->logdie("unknown use_indexer: $use_indexer");                  $log->logdie("unknown use_indexer: $use_indexer");
116          }          }
# Line 220  while (my ($database, $db_config) = each Line 230  while (my ($database, $db_config) = each
230    
231          };          };
232    
233            eval { $indexer->finish } if ($indexer->can('finish'));
234    
235          my $dt = time() - $start_t;          my $dt = time() - $start_t;
236          $log->info("$total_rows records indexed in " .          $log->info("$total_rows records indexed in " .
237                  sprintf("%.2f sec [%.2f rec/sec]",                  sprintf("%.2f sec [%.2f rec/sec]",
# Line 227  while (my ($database, $db_config) = each Line 239  while (my ($database, $db_config) = each
239                  )                  )
240          );          );
241    
242          if ($use_indexer eq 'hyperestraier') {          #
243                  #          # add Hyper Estraier links to other databases
244                  # add Hyper Estraier links to other databases          #
245                  #          if (ref($db_config->{links}) eq 'ARRAY') {
246                  if (ref($db_config->{links}) eq 'ARRAY') {                  foreach my $link (@{ $db_config->{links} }) {
247                          foreach my $link (@{ $db_config->{links} }) {                          if ($use_indexer eq 'hyperestraier') {
248                                  $log->info("adding link $database -> $link->{to} [$link->{credit}]");                                  $log->info("adding link $database -> $link->{to} [$link->{credit}]");
249                                  $indexer->add_link(                                  $indexer->add_link(
250                                          from => $database,                                          from => $database,
251                                          to => $link->{to},                                          to => $link->{to},
252                                          credit => $link->{credit},                                          credit => $link->{credit},
253                                  );                                  );
254                            } else {
255                                    $log->warn("NOT IMPLEMENTED WITH $use_indexer: adding link $database -> $link->{to} [$link->{credit}]");
256                          }                          }
257                  }                  }
         } else {  
                 $log->warn("links not implemented for $use_indexer");  
258          }          }
259    
260  }  }

Legend:
Removed from v.430  
changed lines
  Added in v.434

  ViewVC Help
Powered by ViewVC 1.1.26