13 |
use XML::Feed; |
use XML::Feed; |
14 |
use LWP::UserAgent; |
use LWP::UserAgent; |
15 |
|
|
16 |
|
use Grep::Search; |
17 |
|
|
18 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
19 |
|
|
20 |
use Jifty::Param::Schema; |
use Jifty::Param::Schema; |
126 |
modified => $entry->modified ? $entry->modified->strftime("%Y-%m-%d %H:%M:%S") : undef, |
modified => $entry->modified ? $entry->modified->strftime("%Y-%m-%d %H:%M:%S") : undef, |
127 |
); |
); |
128 |
|
|
129 |
|
$msg ||= ''; |
130 |
|
|
131 |
if ( $ok ) { |
if ( $ok ) { |
132 |
Jifty->log->debug("item ", $i->id, ": $msg"); |
Jifty->log->debug("item ", $i->id, ": $msg"); |
133 |
$items->add_record( $i ); |
$items->add_record( $i ); |
134 |
# count new objects |
|
135 |
$new++ if ($msg !~ m/^Found/); |
# is new record? |
136 |
|
if ( $msg !~ m/^Found/ ) { |
137 |
|
$new++; |
138 |
|
Grep::Search->add( $i ); |
139 |
|
} |
140 |
} else { |
} else { |
141 |
warn "can't add entry ", dump( $entry ), "\n"; |
warn "can't add entry ", dump( $entry ), "\n"; |
142 |
} |
} |
158 |
$self->result->content( items => $items ); |
$self->result->content( items => $items ); |
159 |
$self->result->content( count => $items->count ); |
$self->result->content( count => $items->count ); |
160 |
|
|
161 |
|
Grep::Search->finish if $new; |
162 |
|
|
163 |
} else { |
} else { |
164 |
return $self->result->error( "No results for '$q' in " . $feed->title ); |
return $self->result->error( "No results for '$q' in " . $feed->title ); |
165 |
} |
} |