Devin Austin > Catalyst-Model-Search-ElasticSearch-1.121300 > Catalyst::Model::Search::ElasticSearch

Download:
Catalyst-Model-Search-ElasticSearch-1.121300.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.121300   Source   Latest Release: Catalyst-Model-Search-ElasticSearch-1.142550

NAME ^

Catalyst::Model::Search::ElasticSearch

SYNOPSIS ^

    package My::App;
    use strict;
    use warnings;

    use Catalyst;;

    our $VERSION = '0.01';
    __PACKAGE__->config(
      name            => 'Test::App',
      'Model::Search' => {
        transport    => 'http',
        servers      => 'localhost:9200',
        timeout      => 30,
        max_requests => 10_000
      }
    );

    __PACKAGE__->setup;


    package My::App::Model::Search;
    use Moose;
    use namespace::autoclean;
    extends 'Catalyst::Model::Search::ElasticSearch';

    __PACKAGE__->meta->make_immutable;
    1;

    package My::App::Controller::Root;
    use base 'Catalyst::Controller';
    __PACKAGE__->config(namespace => '');

    sub search : Local {
      my ($self, $c) = @_;
      my $params = $c->req->params;
      my $search = $c->model('Search');
      my $results = $search->search(
        index => 'test',
        type  => 'test',
        query => { term => { schpongle => $params->{'q'} } }
      );
      $c->stash( results => $results );

    }

WARNING ^

This is in very alpha stages. More testing and production use are coming up, but be warned until then.

servers

A list of servers to connect to

transport

The transport to use to interact with the ElasticSearch API. See https://metacpan.org/module/ElasticSearch#Transport-Backends for options.

_additional_opts

Stores other key/value pairs to pass to ElasticSearch

_es

The ElasticSearch object.

SEE ALSO ^

The Catalyst Advent article on integrating ElasticSearch into your app: http://www.catalystframework.org/calendar/2010/2

syntax highlighting: