r243@athlon: dpavlin | 2005-12-06 17:44:43 +0100
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 6 Dec 2005 16:40:18 +0000 (16:40 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 6 Dec 2005 16:40:18 +0000 (16:40 +0000)
 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
lib/WebPAC.pm
lib/WebPAC/Store.pm
run.pl

diff --git a/TODO b/TODO
index 51985ca..91f86e7 100644 (file)
--- 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
index 51f9c7d..560ec7b 100644 (file)
@@ -13,7 +13,7 @@ Version 2.00
 
 =cut
 
-our $VERSION = '2.00';
+our $VERSION = '2.00_1';
 
 =head1 SYNOPSIS
 
index 73345f5..bcc5901 100644 (file)
@@ -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 (executable)
--- 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(