NAME

XML::OPDS::OpenSearch::Query - OpenSearch query element for XML::OPDS

DESCRIPTION

This module is mostly a helper to provide validation to create Query elements in an OPDS search result. Notably, this doesn't expand to XML. The serialization is left to XML::OPDS.

SYNOPSIS

use XML::OPDS;
use XML::OPDS::OpenSearch::Query;
use Data::Page;
my $feed = XML::OPDS->new;
my $query = XML::OPDS::OpenSearch::Query->new(role => "example",
                                              searchTerms => "my terms",
                                              );
my $pager = Data::Page->new;
$pager->total_entries(50);
$pager->entries_per_page(20);
$pager->current_page(1);
$feed->search_result_pager($pager);
$feed->search_result_terms('my terms');

# please note that if you set the search_result_pager and
# search_result_terms a role:request query is added automatically, so
# here we add only the example.

$feed->search_result_queries([$query]);
print $feed->render;

SETTERS/ACCESSORS

All of them are optionals except role.

role

Role values (from http://www.opensearch.org/Specifications/OpenSearch/1.1#Role_values)

request

Represents the search query that can be performed to retrieve the same set of search results.

example

Represents a search query that can be performed to demonstrate the search engine.

Represents a search query that can be performed to retrieve similar but different search results.

correction

Represents a search query that can be performed to improve the result set, such as with a spelling correction.

subset

Represents a search query that will narrow the current set of search results.

superset

Represents a search query that will broaden the current set of search results.

title

Contains a human-readable plain text string describing the search request.

Restrictions: The value must contain 256 or fewer characters of plain text. The value must not contain HTML or other markup.

This object stores an arbitrary string, but cut it at 256 when producing the attributes.

totalResults

Integer.

Contains the expected number of results to be found if the search request were made.

searchTerms

String.

Contains the value representing the "searchTerms" as an OpenSearch 1.1 parameter.

The URI escaping is performed by the module.

count

Integer.

Replaced with the number of search results per page desired by the search client.

startIndex

Integer.

Replaced with the index of the first search result desired by the search client.

startPage

Integer.

Replaced with the page number of the set of search results desired by the search client.

language

String. The value must conform to the XML 1.0 Language Identification, as specified by RFC 5646. In addition, a value of "*" will signify that the search client desires search results in any language.

This module passes it verbatim.

inputEncoding

The value must conform to the XML 1.0 Character Encodings, as specified by the IANA Character Set Assignments.

This module passes it verbatim.

outputEncoding

Same as above.

METHODS

attributes_hashref

Return the attributes which are defined in an hashref. The title is mangled to 256 characters and

SEE ALSO

Specification: http://www.opensearch.org/Specifications/OpenSearch/1.1