--- Webpacus/lib/Webpacus/Model/WebPAC.pm 2006/02/19 12:37:27 399 +++ Webpacus/lib/Webpacus/Model/WebPAC.pm 2006/02/19 13:14:26 400 @@ -12,7 +12,6 @@ use Time::HiRes qw/time/; use Encode qw/encode decode from_to/; use Template; -use Data::Dumper; =head1 NAME @@ -66,7 +65,7 @@ $est_cfg->{encoding} = $est_cfg->{catalyst_encoding} || $c->config->{catalyst_encoding} or $c->log->fatal("can't find catalyst_encoding"); - $log->debug("using config:" . Dumper($est_cfg) ); + $log->dumper($est_cfg, 'est_cfg'); if (! $est_cfg->{database}) { my $defaultnode = $est_cfg->{defaultnode} || $log->logdie("can't find defaultnode in estraier configuration"); @@ -89,7 +88,7 @@ # save config parametars in object foreach my $f (qw/ db_path template_path hits_on_page webpac_encoding defaultdepth - masterurl + masterurl defaultnode /) { $self->{$f} = $c->config->{hyperestraier}->{$f} || $c->config->{webpac}->{$f}; @@ -145,18 +144,21 @@ $self->setup_site('site_name'); -Change node URL and database name according to site name (if available) +Change node URL and database name according to site name (if available) or fallback +to C from configuration. =cut sub setup_site { my $self = shift; - my $site = shift || return; + my $site = shift || $self->{defaultnode}; + + $self->{log}->fatal("setup_site can't find site or defaultnode") unless ($site); my $url = $self->{masterurl} . '/node/' . $site; $self->{est_node}->set_url( $url ); - $self->{log}->debug("setup_site $site"); + $self->{log}->debug("setup_site $site using $url"); } =head2 search @@ -185,7 +187,7 @@ my $log = $self->{log}; - $log->debug("search args: " . Dumper( $args )); + $log->dumper($args, 'args'); my $query = $args->{phrase} || $log->warn("no query phrase") && return; @@ -243,7 +245,7 @@ $log->debug( sprintf("search took %.6fs and returned $hits hits.", $times->{est}) ); - $log->debug( "hints: " . Dumper($result->{hints}) ); + $log->dumper($result->{hints}, 'result->hints' ); # # fetch results @@ -298,8 +300,6 @@ $times->{db} += time() - $t; - #$log->debug( "ds = " . Dumper( \@html_results ) ); - $t = time(); my $html = $self->apply( @@ -322,8 +322,6 @@ } - #$log->debug( '@results = ' . Dumper( \@results ) ); - $log->debug( sprintf( "duration breakdown: estraier %.6fs, hash %.6fs, store %.6fs, apply %.6fs, decode %.06f, total: %.6fs", $times->{est}, $times->{hash}, $times->{db}, $times->{apply}, $times->{decode}, time() - $search_start_t, @@ -349,7 +347,7 @@ my $args = {@_}; my $log = $self->{log}; - $log->debug("record args: " . Dumper( $args )); + $log->dumper( $args, 'args' ); foreach my $f (qw/record_uri template/) { $log->fatal("need $f") unless ($args->{$f});