Class: OpenSearchService

OpenSearchService(descriptionDocument)

Class to perform searches.

Constructor

new OpenSearchService(descriptionDocument)

Create an OpenSearchDescription object
Parameters:
Name Type Description
descriptionDocument OpenSearchDescription The parsed description document
Source:

Methods

(static) deserialize(values) → {OpenSearchService}

Deserialize an OpenSearch description from an object.
Parameters:
Name Type Description
values object The serialized service description
Source:
Returns:
The deserialized service
Type
OpenSearchService

(static) discover(url) → {Promise.<OpenSearchService>}

Accesses an OpenSearch service and discovers it.
Parameters:
Name Type Description
url object The URL to find the OpenSearchDescription XML document
Source:
Returns:
The OpenSearchService as a Promise
Type
Promise.<OpenSearchService>

(static) fromXml(xml) → {OpenSearchService}

Create a new OpenSearchService from an OSDD XML string.
Parameters:
Name Type Description
xml string The XML string to parse the description from
Source:
Returns:
The created service object
Type
OpenSearchService

createSearchRequest(parameters, typeopt, methodopt) → {object}

Returns a base request object for the given parameters. This allows to inspect the request values before sending them to the server.
Parameters:
Name Type Attributes Default Description
parameters object An object mapping the name or type to the value
type string <optional>
null The preferred transfer type.
method string <optional>
null The preferred HTTP method type.
Source:
Returns:
The search request
Type
object

getDescription() → {OpenSearchDescription}

Get the underlying OpenSearchDescription object.
Source:
Returns:
Type
OpenSearchDescription

getPaginator(parameters, typeopt, methodopt, optionsopt) → {OpenSearchPaginator}

Creates a new Paginator object to enable a simpler search result handling for multi-page results.
Parameters:
Name Type Attributes Default Description
parameters object An object mapping the name or type to the value
type string <optional>
null The preferred transfer type.
method string <optional>
null The preferred HTTP method type.
options object <optional>
Additional options for the paginator
Source:
Returns:
The created Paginator object.
Type
OpenSearchPaginator

getSuggestions(parameters, methodopt, maxUrlLengthopt) → {Promise.<Array.<Suggestion>>}

Gets the suggestions for the current search parameters.
Parameters:
Name Type Attributes Default Description
parameters object An object mapping the name or type to the value
method string <optional>
null The preferred HTTP method type.
maxUrlLength number <optional>
The maximum URL length. URLs longer than that will result in errors.
Source:
Returns:
The fetched suggestions.
Type
Promise.<Array.<Suggestion>>

getUrl(parameters, typeopt, methodopt) → {OpenSearchUrl}

Get the URL for the given parameters.
Parameters:
Name Type Attributes Default Description
parameters object An object mapping the name or type to the value
type string <optional>
null The preferred transfer type.
method string <optional>
null The preferred HTTP method type.
Source:
Returns:
The resulting URL objec.
Type
OpenSearchUrl
Checks whether this URL is compatible with the given parameters
Parameters:
Name Type Attributes Default Description
parameters object An object mapping the name or type to the value
type string <optional>
null The preferred transfer type.
method string <optional>
null The preferred HTTP method type.
raw boolean <optional>
false Whether the response shall be parsed or returned raw.
maxUrlLength number <optional>
The maximum URL length. URLs longer than that will result in errors.
Source:
Returns:
The search result as a Promise
Type
Promise.<array> | Promise.<Response>

serialize() → {object}

Serialize the service to a simple object.
Source:
Returns:
The serialized service description
Type
object