Search Example

Here's a quick and dirty example of a search application. It uses Yahoo::Search to do all of the heavy lifting. Create a new application called SearchExample. Create a controller called Search and include this bit and you're done.

sub index : Private {
  my ( $self$c ) = @_;
  use Yahoo::Search AppId => 'SearchExample';
  my $q     = $c->req->param('q');
  my $SearchEngine = Yahoo::Search->new(Count => 5, Start => 0 );
  my $html = $SearchEngine->HtmlResults( Doc => $q);
  $c->response->body($html);
}

Test by visiting http://localhost:3000/search/?q=catalystframework

Also see: Advent Calendar Search Example

My tags:
 
Popular tags:
 
Powered by Catalyst
Powered by MojoMojo Hosted by Shadowcat - Managed by Nordaaker