/[Grep]/lib/Grep/Action/Search.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 /lib/Grep/Action/Search.pm

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

revision 55 by dpavlin, Wed Feb 21 16:19:31 2007 UTC revision 141 by dpavlin, Tue May 8 12:37:28 2007 UTC
# Line 42  use Jifty::Action schema { Line 42  use Jifty::Action schema {
42  sub take_action {  sub take_action {
43      my $self = shift;      my $self = shift;
44    
45          my $q = $self->argument_value('q') || warn "no q?";          my $q = $self->argument_value('q');
46    
47          my $coll = Grep::Search->collection( $q );          return $self->result->error("Need search query") unless ($q);
48    
49          Jifty->log->error('result not collection but ', dump( $coll ))          my $search = Grep::Search->new();
                 unless ( $coll->isa('Jifty::Collection') );  
50    
51          my $results = $coll->count;          my $coll = $search->collection( $q ) ||
52                    return $self->result->error("No results");
53    
54          if ($results > 0) {          $self->log->fatal('result not collection but ', dump( $coll ))
55          $self->result->message( "Found $results results for '$q'" );                  if ( !$coll || !$coll->isa('Jifty::Collection') );
56    
57            my $hits = $search->hits;
58    
59            if ($hits > 0) {
60            $self->result->message( "Found $hits results for '$q'" );
61          } else {          } else {
62                  $self->result->error('No local results, try remote feeds...');                  $self->result->error('No local results, try remote feeds...');
63          }          }

Legend:
Removed from v.55  
changed lines
  Added in v.141

  ViewVC Help
Powered by ViewVC 1.1.26