From a340249d595e2d921af0373114868a4217fe8b69 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 6 Dec 2005 16:40:18 +0000 Subject: [PATCH] r243@athlon: dpavlin | 2005-12-06 17:44:43 +0100 support multiple inputs into same database and multiple databases [2.00_1] git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@233 07558da8-63fa-0310-ba24-9fe276d99e06 --- TODO | 3 ++- lib/WebPAC.pm | 2 +- lib/WebPAC/Store.pm | 8 ++++---- run.pl | 24 ++++++++++++------------ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index 51985ca..91f86e7 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ -- add multiple databases ++ add multiple databases ++ support multiple inputs to single database [2.00_1] - delete unused files in database directories - scoring for various fields in input/*.xml - write pure perl Search::HyperEstraier diff --git a/lib/WebPAC.pm b/lib/WebPAC.pm index 51f9c7d..560ec7b 100644 --- a/lib/WebPAC.pm +++ b/lib/WebPAC.pm @@ -13,7 +13,7 @@ Version 2.00 =cut -our $VERSION = '2.00'; +our $VERSION = '2.00_1'; =head1 SYNOPSIS diff --git a/lib/WebPAC/Store.pm b/lib/WebPAC/Store.pm index 73345f5..bcc5901 100644 --- a/lib/WebPAC/Store.pm +++ b/lib/WebPAC/Store.pm @@ -14,11 +14,11 @@ WebPAC::Store - Store normalized data on disk =head1 VERSION -Version 0.06 +Version 0.07 =cut -our $VERSION = '0.06'; +our $VERSION = '0.07'; =head1 SYNOPSIS @@ -166,11 +166,11 @@ sub load_ds { $log->logconfess("can't find database name") unless ($database); - my $cache_file = "$cache_path/$prefix#$id"; + my $cache_file = "$cache_path/$database/$prefix#$id"; $cache_file =~ s#//#/#go; open(my $fh, '>>', '/tmp/foo'); -print $fh "LOAD $cache_path / $prefix # $id ==> $cache_file\n"; +print $fh "LOAD $cache_path / $database / $prefix # $id ==> $cache_file\n"; close($fh); $log->debug("using cache_file $cache_file"); diff --git a/run.pl b/run.pl index 1137964..e4241c1 100755 --- a/run.pl +++ b/run.pl @@ -28,29 +28,20 @@ my $total_rows = 0; while (my ($database, $db_config) = each %{ $config->{databases} }) { - my $type = lc($db_config->{input}->{type}); - - die "I know only how to handle input type isis, not '$type'!\n" unless ($type eq 'isis'); - my $abs_path = abs_path($0); $abs_path =~ s#/[^/]*$#/#; - my $lookup = new WebPAC::Lookup( - lookup_file => $db_config->{input}->{lookup}, - ); - my $db_path = $config->{webpac}->{db_path} . '/' . $database; - - my $log = $lookup->_get_logger; - $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; @@ -72,6 +63,15 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) { } foreach my $input (@inputs) { + + my $type = lc($input->{type}); + + die "I know only how to handle input type isis, not '$type'!\n" unless ($type eq 'isis'); + + my $lookup = new WebPAC::Lookup( + lookup_file => $input->{lookup}, + ); + $log->info("working on input $input->{path} [$input->{type}]"); my $isis = new WebPAC::Input::ISIS( -- 2.20.1