--- Webpacus/lib/Webpacus/Model/WebPAC.pm 2006/02/19 20:16:11 404 +++ Webpacus/lib/Webpacus/Model/WebPAC.pm 2006/02/19 22:40:40 405 @@ -245,7 +245,8 @@ $log->debug( sprintf("search took %.6fs and returned $hits hits.", $times->{est}) ); - $log->dumper($result->{hints}, 'result->hints' ); + $self->{hints} = $result->{hints}; + $log->dumper($self->{hints}, 'hints' ); # # fetch results @@ -330,6 +331,43 @@ return \@results; } +=head2 hints + + my $hints = $m->hints; + +Return various useful hints about result + +=cut + +sub hints { + my $self = shift; + + unless ($self->{hints}) { + $self->{log}->fatal("no hints found!"); + return; + } + + my $hints; + + while (my ($key,$val) = each %{ $self->{hints} }) { + + if ($key =~ m/^(?:HITS*|TIME|DOCNUM|WORDNUM)$/) { + $hints->{ lc($key) } = $val; + } elsif ($key =~ m/^HINT#/) { + my ($word,$count) = split(/\t/,$val,2); + $hints->{words}->{$word} = $count; + } elsif ($key =~ m/^LINK#/) { + my ($url,undef,undef,undef,undef,undef,$results) = split(/\t/,$val,7); + if ($url =~ m#/node/(.+)$#) { + $hints->{node}->{$1} = $results; + } + } + } + + return $hints; +} + + =head2 record my $html = $m->record(