--- trunk/run.pl 2005/12/15 14:12:00 251 +++ trunk/run.pl 2005/12/16 01:04:20 255 @@ -7,12 +7,13 @@ use Data::Dumper; use lib './lib'; +use WebPAC::Common 0.02; use WebPAC::Lookup; use WebPAC::Input::ISIS; use WebPAC::Store 0.03; use WebPAC::Normalize::XML; use WebPAC::Output::TT; -use WebPAC::Output::Estraier 0.02; +use WebPAC::Output::Estraier 0.05; use YAML qw/LoadFile/; use LWP::Simple; @@ -28,28 +29,37 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) { + my $log = _new WebPAC::Common()->_get_logger(); + + # + # open Hyper Estraier database + # + + my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration"); + $est_config->{database} = $database; + + $log->info("using HyperEstraier URL $est_config->{masterurl}"); + + my $est = new WebPAC::Output::Estraier( + %{ $est_config }, + ); + + # + # now WebPAC::Store + # my $abs_path = abs_path($0); $abs_path =~ s#/[^/]*$#/#; my $db_path = $config->{webpac}->{db_path} . '/' . $database; + $log->info("working on $database in $db_path"); + my $db = new WebPAC::Store( path => $db_path, database => $database, debug => 1, ); - my $log = $db->_get_logger; - $log->info("working on $database in $db_path"); - - my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration"); - $est_config->{database} = $database; - - $log->info("using HyperEstraier URL $est_config->{masterurl}"); - - my $est = new WebPAC::Output::Estraier( - %{ $est_config }, - ); # # now, iterate through input formats @@ -58,12 +68,16 @@ my @inputs; if (ref($db_config->{input}) eq 'ARRAY') { @inputs = @{ $db_config->{input} }; - } else { + } elsif ($db_config->{input}) { push @inputs, $db_config->{input}; + } else { + $log->info("database $database doesn't have inputs defined"); } foreach my $input (@inputs) { +print Dumper($input); + my $type = lc($input->{type}); die "I know only how to handle input type isis, not '$type'!\n" unless ($type eq 'isis'); @@ -85,8 +99,6 @@ code_page => $input->{encoding}, # database encoding ); -$log->info( Dumper($lookup->{_lookup_data}) ); - my $n = new WebPAC::Normalize::XML( # filter => { 'foo' => sub { shift } }, db => $db, @@ -120,5 +132,20 @@ }; $log->info("$total_rows records indexed"); + + # + # 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}, + ); + } + } + }