/[webpac2]/Webpacus/lib/Webpacus/Model/WebPAC.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/lib/Webpacus/Model/WebPAC.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 404 by dpavlin, Sun Feb 19 20:16:11 2006 UTC revision 405 by dpavlin, Sun Feb 19 22:40:40 2006 UTC
# Line 245  sub search { Line 245  sub search {
245    
246          $log->debug( sprintf("search took %.6fs and returned $hits hits.", $times->{est}) );          $log->debug( sprintf("search took %.6fs and returned $hits hits.", $times->{est}) );
247    
248          $log->dumper($result->{hints}, 'result->hints' );          $self->{hints} = $result->{hints};
249            $log->dumper($self->{hints}, 'hints' );
250    
251          #          #
252          # fetch results          # fetch results
# Line 330  sub search { Line 331  sub search {
331          return \@results;          return \@results;
332  }  }
333    
334    =head2 hints
335    
336      my $hints = $m->hints;
337    
338    Return various useful hints about result
339    
340    =cut
341    
342    sub hints {
343            my $self = shift;
344    
345            unless ($self->{hints}) {
346                    $self->{log}->fatal("no hints found!");
347                    return;
348            }
349    
350            my $hints;
351    
352            while (my ($key,$val) = each %{ $self->{hints} }) {
353    
354                    if ($key =~ m/^(?:HITS*|TIME|DOCNUM|WORDNUM)$/) {
355                            $hints->{ lc($key) } = $val;
356                    } elsif ($key =~ m/^HINT#/) {
357                            my ($word,$count) = split(/\t/,$val,2);
358                            $hints->{words}->{$word} = $count;
359                    } elsif ($key =~ m/^LINK#/) {
360                            my ($url,undef,undef,undef,undef,undef,$results) = split(/\t/,$val,7);
361                            if ($url =~ m#/node/(.+)$#) {
362                                    $hints->{node}->{$1} = $results;
363                            }
364                    }
365            }
366    
367            return $hints;
368    }
369    
370    
371  =head2 record  =head2 record
372    
373    my $html = $m->record(    my $html = $m->record(

Legend:
Removed from v.404  
changed lines
  Added in v.405

  ViewVC Help
Powered by ViewVC 1.1.26