NAME

Search::OpenSearch::Server - serve OpenSearch results

DESCRIPTION

Search::OpenSearch::Server is a Moose::Role.

METHODS

The following methods are available to consumers.

engine

A Search::OpenSearch::Engine instance created by init_engine or passed to new().

init_engine

Returns a Search::OpenSearch::Engine instance, passing in the contents of engine_config with the logger param set to $self.

engine_config

Defaults to an empty hashref.

init_engine_config

Returns empty hashref.

stats_logger

Expects an object of some kind.

http_allow

Expects an array ref of HTTP method names.

do_search( request, response )

Performs a search using a Search::OpenSearch::Engine set in engine().

request

A Request object. Should act like a Plack::Request or a Catalyst::Request.

response

A Response object. Should act like a Plack::Response or a Catalyst::Response.

Will return the response object.

do_rest_api( request, response[, path] )

Calls the appropriate REST method on the engine().

request

A Request object. Should act like a Plack::Request or a Catalyst::Request.

response

A Response object. Should act like a Plack::Response or a Catalyst::Response.

Will return the response object.

The following HTTP headers are supported for explicitly setting the indexer behavior:

X-SOS-Content-Location
X-SOS-Last-Modified
X-SOS-Parser-Type
X-SOS-Content-Type
X-SOS-Encoding

handle_no_query( request, response )

If no 'q' param is present in the Plack::Request, this method is called. The default behavior is to set a 400 (bad request) with error message. You can override it to behave more kindly.

request

A Request object. Should act like a Plack::Request or a Catalyst::Request.

response

A Response object. Should act like a Plack::Response or a Catalyst::Response.

Will return the response object.

log( msg [, <level ] )

Utility method. Default is to warn(msg).

setup_engine

A no-op for backwards compatability for pre-Moose version of this class.

AUTHOR

Peter Karman, <karman at cpan.org>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Search::OpenSearch::Server

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2010 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.