20 |
sub take_action { |
sub take_action { |
21 |
my $self = shift; |
my $self = shift; |
22 |
|
|
23 |
|
my $q = $self->argument_value('content_contains') || warn "can't find content_contains"; |
24 |
|
|
25 |
$self->SUPER::take_action( @_ ); |
$self->SUPER::take_action( @_ ); |
26 |
|
|
27 |
my $coll = $self->result->content('search'); |
my $coll = $self->result->content('search'); |
29 |
Jifty->log->error('result not collection but ', dump( $coll )) |
Jifty->log->error('result not collection but ', dump( $coll )) |
30 |
unless ( $coll->isa('Jifty::Collection') ); |
unless ( $coll->isa('Jifty::Collection') ); |
31 |
|
|
32 |
if ($coll->count > 0) { |
my $results = $coll->count; |
33 |
$self->result->message( 'Found ' . $coll->count . ' results' ); |
|
34 |
|
if ($results > 0) { |
35 |
|
$self->result->message( "Found $results results" ); |
36 |
|
|
37 |
warn "### about to fork!"; |
warn "### about to fork!"; |
38 |
|
|
39 |
if (fork) { |
if (fork) { |
40 |
my $t = $coll->count; |
my $t = $results; |
41 |
warn "### sleeping $t s..."; |
warn "### sleeping $t s..."; |
42 |
sleep $t; |
sleep $t; |
43 |
Grep::Event::Result->new({ coll => $coll, item_fragment => 'title' })->publish; |
warn "### pushing results for $q after $t s"; |
44 |
|
|
45 |
|
Jifty->log->error('result not collection but ', dump( $coll )) |
46 |
|
unless ( $coll->isa('Jifty::Collection') ); |
47 |
|
Grep::Event::Result->new({ q => $q, coll => $coll, item_fragment => 'long' })->publish; |
48 |
exit 0; |
exit 0; |
49 |
} |
} |
50 |
|
|