Subject: | approximate_result_count() always returns zero |
Hi,
When approximate_result_count() is called without calling neither results() nor next_result(), approximate_result_count() always returns zero.
use WWW::Search;
$engine = new WWW::Search("Backend");
$engine->native_query("keyword");
print $engine->approximate_result_count();
In order to avoid this problem, I propose the attached change.
Regards,
--- lib/WWW/Search.pm~ Tue Jul 29 10:25:44 2003
+++ lib/WWW/Search.pm Tue Oct 14 09:09:37 2003
@@ -606,7 +606,7 @@
{
my $self = shift;
# prime the pump:
- $self->retrieve_some() if ($self->{'state'} == SEARCH_BEFORE);
+ $self->retrieve_some() if ($self->{'state'} == SEARCH_BEFORE or $self->{'state'} == SEARCH_UNDERWAY);
return $self->_elem('approx_count', @_);
} # approximate_result_count