--- trunk/lib/WebPAC/Output/Estraier.pm 2005/12/16 01:47:20 256 +++ trunk/lib/WebPAC/Output/Estraier.pm 2005/12/24 11:23:17 319 @@ -17,11 +17,11 @@ =head1 VERSION -Version 0.05 +Version 0.08 =cut -our $VERSION = '0.05'; +our $VERSION = '0.08'; =head1 SYNOPSIS @@ -40,6 +40,7 @@ passwd => 'admin', database => 'demo', encoding => 'iso-8859-2', + clean => 1, ); Options are: @@ -90,14 +91,19 @@ my $url = $self->{masterurl} . '/node/' . $self->{database}; $self->{url} = $url; - $log->info("opening Hyper Estraier 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' ); $log->debug("nodes found: $nodes"); if ($nodes !~ m/^$self->{database}\t/sm) { - $log->info("creating index $url"); + $log->warn("creating index $url"); $self->master( action => 'nodeadd', name => $self->{database}, @@ -109,7 +115,7 @@ $self->{'db'}->set_auth($self->{'user'}, $self->{passwd}); my $encoding = $self->{'encoding'} || 'ISO-8859-2'; - $log->info("using encoding $encoding"); + $log->info("using index $self->{url} with encoding $encoding"); $self->{'iconv'} = new Text::Iconv($encoding, 'UTF-8') or $log->logdie("can't create conversion from $encoding to UTF-8"); @@ -193,7 +199,7 @@ } $log->debug("adding ", sub { $doc->dump_draft } ); - $self->{'db'}->put_doc($doc) || $log->logdie("can't add document $uri to node " . $self->{url} . " status: " . $self->{db}->status()); + $self->{'db'}->put_doc($doc) || $log->warn("can't add document $uri with draft " . $doc->dump_draft . " to node " . $self->{url} . " status: " . $self->{db}->status()); return 1; } @@ -239,6 +245,7 @@ validate => 'master', rest_url => $self->{masterurl} . '/master?action=' . $action , action => $action, + %{ $args }, ); } @@ -262,9 +269,9 @@ $log->debug("got labels: ", join("|", @labels)); - @labels = grep(/^$args->{to}/, @labels); - - my (undef,$label) = split(/\t/, shift @labels); + @labels = grep(/^$args->{to}\t/, @labels); + my $label = shift @labels; + (undef,$label) = split(/\t/, $label) if ($label); if (! $label) { $log->warn("can't find label for $args->{to}, skipping link creaton"); @@ -322,8 +329,7 @@ $del = '&'; } - $url_args =~ s#^\&#?# if ($url =~ m#\?#); - $url .= $url_args; + $url .= $url_args if ($url_args); $log->debug("calling $url");