Search::OpenSearch::Server::Catalyst - serve OpenSearch results with Catalyst
package MyApp::Controller::API; use Moose; extends 'Catalyst::Controller'; with 'Search::OpenSearch::Server'; with 'Search::OpenSearch::Server::Catalyst'; use MyStats; # acts like a Dezi::Stats subclass __PACKAGE__->config( engine_config = { type => 'Lucy', index => ['path/to/your/index'], facets => { names => [qw( topics people places orgs author )], sample_size => 10_000, }, fields => [qw( topics people places orgs author )], }, stats_logger => MyStats->new(), ); 1; # now you can: # GET /api/search # POST /api/foo/bar
NOTE This class used to be a Controller subclass. It is Role as of version 0.300.
Search::OpenSearch::Server::Catalyst is a consumable Role used by CatalystX::Controller::OpenSearch. If you just want a simple controller, you probably want CatalystX::Controller::OpenSearch.
This class isa MooseX::MethodAttributes::Role. Only new or overridden methods are documented here.
This method registers a URL action in the controller namespace.
The default() action passes the ctx and any other path args to process_request(). Override this method to control what your addressable URL(s) look like.
Process the incoming request and create a response. The algorithm is, briefly:
GET -> do_search() POST, PUT, DELETE -> do_rest_api()
args is an array joined with / to create an actionable path. If that path is the string search or is empty, then do_search() is triggered on GET requests. The path is ignored for all non-GET requests.
/
search
Passes msg on to the app $ctx->log method. level defaults to debug and will only be passed to $ctx->log if $ctx->debug is true.
debug
Peter Karman, <karman at cpan.org>
<karman at cpan.org>
Please report any bugs or feature requests to bug-search-opensearch-server at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Search-OpenSearch-Server. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-search-opensearch-server at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Search::OpenSearch::Server::Catalyst
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Search-OpenSearch-Server
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Search-OpenSearch-Server
CPAN Ratings
http://cpanratings.perl.org/d/Search-OpenSearch-Server
Search CPAN
http://search.cpan.org/dist/Search-OpenSearch-Server/
Copyright 2012 Peter Karman.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Search::OpenSearch::Server, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::OpenSearch::Server
CPAN shell
perl -MCPAN -e shell install Search::OpenSearch::Server
For more information on module installation, please visit the detailed CPAN module installation guide.