XML::OPDS::OpenSearch::Query - OpenSearch query element for XML::OPDS
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.
Query
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;
All of them are optionals except role.
role
Role values (from http://www.opensearch.org/Specifications/OpenSearch/1.1#Role_values)
Represents the search query that can be performed to retrieve the same set of search results.
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.
Represents a search query that can be performed to improve the result set, such as with a spelling correction.
Represents a search query that will narrow the current set of search results.
Represents a search query that will broaden the current set of search results.
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.
Integer.
Contains the expected number of results to be found if the search request were made.
String.
Contains the value representing the "searchTerms" as an OpenSearch 1.1 parameter.
The URI escaping is performed by the module.
Replaced with the number of search results per page desired by the search client.
Replaced with the index of the first search result desired by the search client.
Replaced with the page number of the set of search results desired by the search client.
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.
The value must conform to the XML 1.0 Character Encodings, as specified by the IANA Character Set Assignments.
Same as above.
Return the attributes which are defined in an hashref. The title is mangled to 256 characters and
title
Specification: http://www.opensearch.org/Specifications/OpenSearch/1.1
To install XML::OPDS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::OPDS
CPAN shell
perl -MCPAN -e shell install XML::OPDS
For more information on module installation, please visit the detailed CPAN module installation guide.