/[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 335 by dpavlin, Sat Dec 31 14:00:36 2005 UTC revision 416 by dpavlin, Sun Feb 26 23:21:50 2006 UTC
# Line 13  use WebPAC::Input 0.03; Line 13  use WebPAC::Input 0.03;
13  use WebPAC::Store 0.03;  use WebPAC::Store 0.03;
14  use WebPAC::Normalize::XML;  use WebPAC::Normalize::XML;
15  use WebPAC::Output::TT;  use WebPAC::Output::TT;
16  use WebPAC::Output::Estraier 0.08;  use WebPAC::Output::Estraier '0.10';
17  use YAML qw/LoadFile/;  use YAML qw/LoadFile/;
18  use Getopt::Long;  use Getopt::Long;
19  use File::Path;  use File::Path;
20    use Time::HiRes qw/time/;
21    
22  =head1 NAME  =head1 NAME
23    
# Line 76  print "config = ",Dumper($config) if ($d Line 77  print "config = ",Dumper($config) if ($d
77  die "no databases in config file!\n" unless ($config->{databases});  die "no databases in config file!\n" unless ($config->{databases});
78    
79  my $total_rows = 0;  my $total_rows = 0;
80    my $start_t = time();
81    
82  while (my ($database, $db_config) = each %{ $config->{databases} }) {  while (my ($database, $db_config) = each %{ $config->{databases} }) {
83    
# Line 90  while (my ($database, $db_config) = each Line 92  while (my ($database, $db_config) = each
92          my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration");          my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration");
93          $est_config->{database} = $database;          $est_config->{database} = $database;
94          $est_config->{clean} = $clean;          $est_config->{clean} = $clean;
95            $est_config->{label} = $db_config->{name};
96    
97          my $est = new WebPAC::Output::Estraier( %{ $est_config } );          my $est = new WebPAC::Output::Estraier( %{ $est_config } );
98    
# Line 105  while (my ($database, $db_config) = each Line 108  while (my ($database, $db_config) = each
108                  $log->info("creating new database $database in $db_path");                  $log->info("creating new database $database in $db_path");
109                  rmtree( $db_path ) || $log->warn("can't remove $db_path: $!");                  rmtree( $db_path ) || $log->warn("can't remove $db_path: $!");
110          } else {          } else {
111                  $log->info("working on $database in $db_path");                  $log->debug("working on $database in $db_path");
112          }          }
113    
114          my $db = new WebPAC::Store(          my $db = new WebPAC::Store(
# Line 142  while (my ($database, $db_config) = each Line 145  while (my ($database, $db_config) = each
145    
146                  my $input_module = $config->{webpac}->{inputs}->{$type};                  my $input_module = $config->{webpac}->{inputs}->{$type};
147    
148                  $log->info("working on input $input->{path} [$input->{type}] using $input_module");                  $log->info("working on input '$input->{path}' [$input->{type}] using $input_module lookup '$input->{lookup}'");
149    
150                  my $input_db = new WebPAC::Input(                  my $input_db = new WebPAC::Input(
151                          module => $input_module,                          module => $input_module,
# Line 150  while (my ($database, $db_config) = each Line 153  while (my ($database, $db_config) = each
153                          limit => $limit || $input->{limit},                          limit => $limit || $input->{limit},
154                          offset => $offset,                          offset => $offset,
155                          lookup => $lookup,                          lookup => $lookup,
156                            recode => $input->{recode},
157                  );                  );
158                  $log->logdie("can't create input using $input_module") unless ($input);                  $log->logdie("can't create input using $input_module") unless ($input);
159    
# Line 205  while (my ($database, $db_config) = each Line 209  while (my ($database, $db_config) = each
209    
210          };          };
211    
212          $log->info("$total_rows records indexed");          my $dt = time() - $start_t;
213            $log->info("$total_rows records indexed in " .
214                    sprintf("%.2f sec [%.2f rec/sec]",
215                            $dt, ($total_rows / $dt)
216                    )
217            );
218    
219          #          #
220          # add Hyper Estraier links to other databases          # add Hyper Estraier links to other databases

Legend:
Removed from v.335  
changed lines
  Added in v.416

  ViewVC Help
Powered by ViewVC 1.1.26