Project owner:Benjamin Schell

A store implementing the API for talking to OpenSearch based search providing services. For specific information on the concepts of and its APIs please refer to the API documentation.


This store takes in the OpenSearch Descriptor and uses that to configure how a search query is issued. It can also take the search results and present them as data store formatted items for a wide variety of return formats for OpenSearch results. For more information on the general concepts behind OpenSearch, please refer to OpenSearch project.


  • This store uses dojo.xhrGet and other xhr functions to fetch the OpenSearch descriptor and make search queries. Therefore, the OpenSearchStore is limited by the browser 'same domain' policy for xhr requests. Therefore, to make OpenSearch calls to providers that reside on servers other than the one that provided the HTML file that instantiated the OpenSearchStore, a proxy must be used.
  • The OpenSearchStore does not currently support HTML return formats. The reason for this is an open issue with dojo.query and searching by ID. The bug the OpenSearchStore is blocked on can be found here.

Supported APIs

The following APIs are implemented by OpenSearchStore:

Constructor Parameters

Parameter Required Description Since
url Yes This parameter specifies the URL from which to load the OSD (OpenSearch Descriptor) document from. This is required as the OSD file contains all the information required to configure the store to issue queries. 1.3
urlPreventCache No Flag denoting whether or not browser caching should be avoided. Defaults to true. 1.4

Attribute List

An OpenSearch search result is a simplistic data item. It contains very few attributes that are accessible. Please refer to the table below for what current attributes are accessible via the getValue(s) functions of the API

Attribute Description Type
content The content/text returned for the search result string

Query Syntax

The fetch method query syntax for OpenSearchStore is limited to what the OpenSearch specification allows, which is a single parameter called 'searchTerms'. The OpenSearchStore expects this parameter to be part of the query argument of its fetch object as a name/value key set in JavaScript object. For an example, see below:

var fetchArgs = {query: { searchTerms: "Some random terms"}, onComplete: function(items){ /* do something */});


Example 1: Programmatic instantiation and querying through OpenSearch

Note that this makes use of a pseudo-proxy to handle dealing with xhr limitations. This proxy is not intended for commercial use, it is only used here to facilitate showing working examples.


// This function performs some basic dojo initialization and will do the fetch calling for this example
function initSimple(){
  var openSearchStore = new{url:"{{dataUrl}}dojox/data/demos/openSearchProxy.php?osd=true&url="});

  dojo.connect(dijit.byId("simpleFetchButton"), "onClick", function(){
    function gotResults(items, request){
        // Got the items, let's attach in the search results.
        var list = dojo.byId("list");
        list.innerHTML = "";
        for(i = 0; i < items.length; i++){
          var e = items[i];

          // Build some divs to contain and style the contents a bit...
          var content = dojo.doc.createElement("div");
          var cDiv = dojo.doc.createElement("div");
          var tDiv = dojo.doc.createElement("div");


          // Put a border around the content container.
, "borderStyle", "solid");
, "borderWidth", "1px");
, "borderColor", "darkgreen");
, "width", "100%");

          // Style a 'title bar'.
, "backgroundColor", "darkgreen");
, "color", "white");
, "width", "100%");
          tDiv.innerHTML = "Search result: [" + i + "]";

          content.innerHTML = openSearchStore.getValue(e, "content");
    function err(e){
    openSearchStore.fetch({query: {searchTerms: dijit.byId("searchBox").attr("value")}, onComplete: gotResults, onError: err});
// Set the init function to run when dojo loading and page parsing has completed.
<input id="searchBox" type="text" data-dojo-type="dijit.form.TextBox" value="dojo"></input>
<div data-dojo-type="dijit.form.Button" id="simpleFetchButton">Click me to search the Interwingly Blog Service</div>
<div id="list"></div>