moved clean into WebPAC::Output::Estraier, cleanup
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 20 Dec 2005 00:03:04 +0000 (00:03 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 20 Dec 2005 00:03:04 +0000 (00:03 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@307 07558da8-63fa-0310-ba24-9fe276d99e06

Makefile.PL
lib/WebPAC/Input.pm
lib/WebPAC/Input/ISIS.pm
lib/WebPAC/Input/MARC.pm
lib/WebPAC/Output/Estraier.pm
run.pl

index 93122da..c46b115 100644 (file)
@@ -59,8 +59,8 @@ config_yml:
 run: config_yml
        ./run.pl --clean --limit 100
 
-index: config_yml
-       ./run.pl --clean
+full: config_yml
+       ./run.pl
 
 MAKE_MORE
 }
index 416844e..8c1339e 100644 (file)
@@ -3,8 +3,6 @@ package WebPAC::Input;
 use warnings;
 use strict;
 
-use blib;
-
 use WebPAC::Common;
 use base qw/WebPAC::Common/;
 use Text::Iconv;
index f102648..24578af 100644 (file)
@@ -3,7 +3,6 @@ package WebPAC::Input::ISIS;
 use warnings;
 use strict;
 
-use blib;
 use WebPAC::Input;
 
 =head1 NAME
index 80eca25..7707bc8 100644 (file)
@@ -3,8 +3,6 @@ package WebPAC::Input::MARC;
 use warnings;
 use strict;
 
-use blib;
-
 use MARC::Fast;
 
 =head1 NAME
index a774360..2cd1460 100644 (file)
@@ -17,11 +17,11 @@ WebPAC::Output::Estraier - Create Hyper Estraier full text index
 
 =head1 VERSION
 
-Version 0.07
+Version 0.08
 
 =cut
 
-our $VERSION = '0.07';
+our $VERSION = '0.08';
 
 =head1 SYNOPSIS
 
@@ -40,6 +40,7 @@ Connect to Hyper Estraier index using HTTP
        passwd => 'admin',
        database => 'demo',
        encoding => 'iso-8859-2',
+       clean => 1,
  );
 
 Options are:
@@ -90,7 +91,12 @@ sub new {
        my $url = $self->{masterurl} . '/node/' . $self->{database};
        $self->{url} = $url;
 
-       $log->debug("opening index $self->{url}");
+       if ($self->{clean}) {
+               $log->debug("nodedel $self->{database}");
+               $self->master( action => 'nodedel', name => $self->{database} );
+       } else {
+               $log->debug("opening index $self->{url}");
+       }
 
        my $nodes = $self->master( action => 'nodelist' );
 
@@ -265,7 +271,7 @@ sub add_link {
 
        @labels = grep(/^$args->{to}\t/, @labels);
        my $label = shift @labels;
-       $label = split(/\t/, $label)->[1] if ($label);
+       (undef,$label) = split(/\t/, $label) if ($label);
 
        if (! $label) {
                $log->warn("can't find label for $args->{to}, skipping link creaton");
diff --git a/run.pl b/run.pl
index e5bcdad..4f99408 100755 (executable)
--- a/run.pl
+++ b/run.pl
@@ -13,7 +13,7 @@ use WebPAC::Input 0.03;
 use WebPAC::Store 0.03;
 use WebPAC::Normalize::XML;
 use WebPAC::Output::TT;
-use WebPAC::Output::Estraier 0.05;
+use WebPAC::Output::Estraier 0.08;
 use YAML qw/LoadFile/;
 use Getopt::Long;
 use File::Path;
@@ -81,16 +81,9 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) {
 
        my $est_config = $config->{hyperestraier} || $log->logdie("can't find 'hyperestraier' part in confguration");
        $est_config->{database} = $database;
+       $est_config->{clean} = $clean;
 
-       my $est = new WebPAC::Output::Estraier(
-               %{ $est_config },
-       );
-
-       if ($clean) {
-               $log->warn("creating new empty index $database");
-               $est->master( action => 'nodedel', name => $database );
-               $est->master( action => 'nodeadd', name => $database, label => $database );
-       }
+       my $est = new WebPAC::Output::Estraier( %{ $est_config } );
 
        #
        # now WebPAC::Store