NAME
Search::OpenSearch::Response - provide search results in OpenSearch format
SYNOPSIS
use Search::OpenSearch;
my $engine = Search::OpenSearch->engine(
type => 'KSx',
index => [qw( path/to/index1 path/to/index2 )],
facets => {
names => [qw( color size flavor )],
sample_size => 10_000,
},
fields => [qw( color size flavor )],
);
my $response = $engine->search(
q => 'quick brown fox', # query
s => 'rank desc', # sort order
o => 0, # offset
p => 25, # page size
h => 1, # highlight query terms in results
c => 0, # return count stats only (no results)
L => 'field|low|high', # limit results to inclusive range
f => 1, # include facets
format => 'XML', # or JSON
);
print $response;
DESCRIPTION
Search::OpenSearch::Response is an abstract base class with some common methods for all Response subclasses.
METHODS
This class is a subclass of Rose::ObjectX::CAF. Only new or overridden methods are documented here.
init
Sets some defaults for a new Response.
The following standard get/set attribute methods are available:
- debug
- results
-
An interator object behaving like SWISH::Prog::Results.
- total
- offset
- page_size
- fields
- facets
- query
- pps
-
Pages-per-section. Used by Data::Pageset. Default is "10".
- title
- link
fetch_results
Returns arrayref of hashrefs representing the results().
fetch_facets
Returns arrayref of hashrefs representing the facets of results().
fetch_pager
Returns Data::Pageset object based on offset() and page_size().
stringify
Returns the Response in the chosen serialization format.
Response objects are overloaded to call stringify().
AUTHOR
Peter Karman, <karman at cpan.org>
BUGS
Please report any bugs or feature requests to bug-search-opensearch at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Search-OpenSearch. 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::Response
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
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.