23 |
hint is 'enter few words to search for'; |
hint is 'enter few words to search for'; |
24 |
|
|
25 |
param item_fragment => |
param item_fragment => |
26 |
label is 'Show', |
label is 'Display format', |
27 |
render as 'select', |
render as 'select', |
28 |
available are qw/long short title/; |
available are qw/long short title/; |
29 |
|
|
30 |
|
param max => |
31 |
|
label is 'Number or results', |
32 |
|
render as 'select', |
33 |
|
available are qw/10 20 50 100/; |
34 |
|
default is '20'; |
35 |
|
|
36 |
}; |
}; |
37 |
|
|
38 |
=head2 take_action |
=head2 take_action |
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 |
|
return $self->result->error("Need search query") unless ($q); |
48 |
|
|
49 |
|
my $search = Grep::Search->new(); |
50 |
|
|
51 |
my $coll = Grep::Search->collection( $q ); |
my $coll = $search->collection( $q ) || |
52 |
|
return $self->result->error("No results"); |
53 |
|
|
54 |
Jifty->log->error('result not collection but ', dump( $coll )) |
$self->log->fatal('result not collection but ', dump( $coll )) |
55 |
unless ( $coll->isa('Jifty::Collection') ); |
if ( !$coll || !$coll->isa('Jifty::Collection') ); |
56 |
|
|
57 |
my $results = $coll->count; |
my $results = $coll->count; |
58 |
|
|