Core-Gadget - OpenSearch

#. OpenSearch

The "opensearch" feature allows gadgets to declare that searchable
material is provided using an OpenSearch 1.1 description.

The OpenSeach description can either be passed directly as a parameter
of the feature or by reference using the URL of a description
document.

For example:

 <?xml version="1.0" encoding="UTF-8" ?>
 <Module>
   <ModulePrefs title="OpenSearch Example">
     <Optional feature="opensearch">
       <Param name="description">
         <![CDATA[
           <OpenSearchDescription
xmlns="http://a9.com/-/spec/opensearch/1.1/">
             <ShortName>Example Search</ShortName>
             <Description>Realtime Example Search</Description>
             <Url type="application/atom+xml" method="get"
template="http://search.example.com/search.atom?q={searchTerms}"/>
             <Image width="16"
height="16">http://search.example.com/favicon.png</Image>
             <InputEncoding>UTF-8</InputEncoding>
             <SearchForm>http://search.example.com/</SearchForm>
           </OpenSearchDescription>
         ]]>
       </Param>
     </Optional>
   </ModulePrefs>
   <Content type="url" href="http://example.com/searchGadget.xml" />
 </Module>

Or, alternatively, using a URL to reference the description document:

 <?xml version="1.0" encoding="UTF-8" ?>
 <Module>
   <ModulePrefs title="OpenSearch Example">
     <Optional feature="opensearch">
       <Param
name="url">http://search.example.com/openSearchDescription.xml</Param>
     </Optional>
   </ModulePrefs>
   <Content type="url" href="http://example.com/searchGadget.xml" />
 </Module>

As illustrated, support for the "opensearch" feature is specified by
including either an "Optional" or "Required" element within the
"ModulePrefs" of the Gadget specification. The feature identifier is
"opensearch". Developers SHOULD declare the feature as "Optional" to
allow for maximum interoperability in all containers.

The feature has two possible parameters: description and url:

 - The description parameter contains the full XML of the OpenSearch
1.1 description. This description contains the template url for
fetching results, the type of results returned, the title of the
search contribution, and other information.
 - The url parameter contains a URL to an XML document containing the
OpenSearch 1.1 description.