87 |
$log->fatal("can't create Search::Estraier::Node $url") unless ($self->{est_node}); |
$log->fatal("can't create Search::Estraier::Node $url") unless ($self->{est_node}); |
88 |
|
|
89 |
# save config parametars in object |
# save config parametars in object |
90 |
foreach my $f (qw/db_path template_path hits_on_page webpac_encoding defaultdepth/) { |
foreach my $f (qw/ |
91 |
|
db_path template_path hits_on_page webpac_encoding defaultdepth |
92 |
|
masterurl |
93 |
|
/) { |
94 |
$self->{$f} = $c->config->{hyperestraier}->{$f} || |
$self->{$f} = $c->config->{hyperestraier}->{$f} || |
95 |
$c->config->{webpac}->{$f}; |
$c->config->{webpac}->{$f}; |
96 |
$log->debug("self->{$f} = " . $self->{$f}); |
$log->debug("self->{$f} = " . $self->{$f}); |
141 |
|
|
142 |
} |
} |
143 |
|
|
144 |
|
=head2 setup_site |
145 |
|
|
146 |
|
$self->setup_site('site_name'); |
147 |
|
|
148 |
|
Change node URL and database name according to site name (if available) |
149 |
|
|
150 |
|
=cut |
151 |
|
|
152 |
|
sub setup_site { |
153 |
|
my $self = shift; |
154 |
|
|
155 |
|
my $site = shift || return; |
156 |
|
|
157 |
|
my $url = $self->{masterurl} . '/node/' . $site; |
158 |
|
$self->{est_node}->set_url( $url ); |
159 |
|
$self->{log}->debug("setup_site $site"); |
160 |
|
} |
161 |
|
|
162 |
=head2 search |
=head2 search |
163 |
|
|
234 |
$page = 1; |
$page = 1; |
235 |
} |
} |
236 |
|
|
|
$times->{est} += time() - $t; |
|
|
|
|
237 |
$cond->set_max( $page * $max ); |
$cond->set_max( $page * $max ); |
238 |
|
|
239 |
my $result = $self->{est_node}->search($cond, $args->{depth}); |
my $result = $self->{est_node}->search($cond, $args->{depth}); |
240 |
my $hits = $result->doc_num; |
my $hits = $result->doc_num; |
241 |
|
|
242 |
|
$times->{est} += time() - $t; |
243 |
|
|
244 |
$log->debug( sprintf("search took %.6fs and returned $hits hits.", $times->{est}) ); |
$log->debug( sprintf("search took %.6fs and returned $hits hits.", $times->{est}) ); |
245 |
|
|
246 |
|
$log->debug( "hints: " . Dumper($result->{hints}) ); |
247 |
|
|
248 |
# |
# |
249 |
# fetch results |
# fetch results |
250 |
# |
# |