--- lib/Grep/Action/Fetch.pm 2007/02/20 22:44:59 46 +++ lib/Grep/Action/Fetch.pm 2007/02/21 03:04:48 47 @@ -13,6 +13,8 @@ use XML::Feed; use LWP::UserAgent; +use Grep::Search; + use Data::Dump qw/dump/; use Jifty::Param::Schema; @@ -124,11 +126,17 @@ modified => $entry->modified ? $entry->modified->strftime("%Y-%m-%d %H:%M:%S") : undef, ); + $msg ||= ''; + if ( $ok ) { Jifty->log->debug("item ", $i->id, ": $msg"); $items->add_record( $i ); - # count new objects - $new++ if ($msg !~ m/^Found/); + + # is new record? + if ( $msg !~ m/^Found/ ) { + $new++; + Grep::Search->add( $i ); + } } else { warn "can't add entry ", dump( $entry ), "\n"; } @@ -150,6 +158,8 @@ $self->result->content( items => $items ); $self->result->content( count => $items->count ); + Grep::Search->finish if $new; + } else { return $self->result->error( "No results for '$q' in " . $feed->title ); }