From df73405b68a8d76a52016d7357d53508d0f8d393 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 17 Apr 2006 15:09:54 +0000 Subject: [PATCH] r519@llin: dpavlin | 2006-04-17 16:40:54 +0200 make support for WebPAC::Output::Estraier optional git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@430 07558da8-63fa-0310-ba24-9fe276d99e06 --- run.pl | 58 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/run.pl b/run.pl index 4f8fb91..7aa61b2 100755 --- a/run.pl +++ b/run.pl @@ -13,7 +13,6 @@ use WebPAC::Input 0.03; 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 @@ $config = LoadFile($config); 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 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) { 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 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) { 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 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) { ) ); - # - # 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"); } } -- 2.20.1