--- trunk/run.pl 2006/03/22 00:18:56 423 +++ trunk/run.pl 2006/04/17 15:09:54 430 @@ -13,7 +13,6 @@ use WebPAC::Store 0.03; use WebPAC::Normalize::XML; use WebPAC::Output::TT; -use WebPAC::Output::Estraier '0.10'; use YAML qw/LoadFile/; use Getopt::Long; use File::Path; @@ -76,6 +75,7 @@ print "config = ",Dumper($config) if ($debug); die "no databases in config file!\n" unless ($config->{databases}); +my $use_indexer = $config->{use_indexer} || 'hyperestraier'; my $total_rows = 0; my $start_t = time(); @@ -86,16 +86,26 @@ my $log = _new WebPAC::Common()->_get_logger(); - # - # open Hyper Estraier database - # + my $indexer; + + if ($use_indexer eq 'hyperestraier') { - my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration"); - $est_config->{database} = $database; - $est_config->{clean} = $clean; - $est_config->{label} = $db_config->{name}; + # + # open Hyper Estraier database + # + + use WebPAC::Output::Estraier '0.10'; + my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration"); + $est_config->{database} = $database; + $est_config->{clean} = $clean; + $est_config->{label} = $db_config->{name}; + + $indexer = new WebPAC::Output::Estraier( %{ $est_config } ); + } else { + $log->logdie("unknown use_indexer: $use_indexer"); + } - my $est = new WebPAC::Output::Estraier( %{ $est_config } ); + $log->logide("can't continue without valid indexer") unless ($indexer); # # now WebPAC::Store @@ -199,10 +209,10 @@ my $ds = $n->data_structure($row); - $est->add( + $indexer->add( id => $input->{name} . "/" . $mfn, ds => $ds, - type => $config->{hyperestraier}->{type}, + type => $config->{$use_indexer}->{type}, ); $total_rows++; @@ -217,18 +227,22 @@ ) ); - # - # add Hyper Estraier links to other databases - # - if (ref($db_config->{links}) eq 'ARRAY') { - foreach my $link (@{ $db_config->{links} }) { - $log->info("adding link $database -> $link->{to} [$link->{credit}]"); - $est->add_link( - from => $database, - to => $link->{to}, - credit => $link->{credit}, - ); + if ($use_indexer eq 'hyperestraier') { + # + # add Hyper Estraier links to other databases + # + if (ref($db_config->{links}) eq 'ARRAY') { + foreach my $link (@{ $db_config->{links} }) { + $log->info("adding link $database -> $link->{to} [$link->{credit}]"); + $indexer->add_link( + from => $database, + to => $link->{to}, + credit => $link->{credit}, + ); + } } + } else { + $log->warn("links not implemented for $use_indexer"); } }