SOS

Shane O’Sullivan’s technical blog… really ties the room together

Google and Dojo, Sitting in a tree…

Posted by Shane O'Sullivan on 1 May, 2008

I’ve submitted a bunch of new data stores to the Dojo Ajax Toolkit that make it simple to search Google directly from your own site (ticket here).

Update: I’ve also submitted a store to read any Atom or RSS feed, anywhere, without any server redirects. See Google And Dojo, F.E.E.D.I.N.G

This is different from putting a search box on your site and redirecting to Google. With the new dojox.data.GoogleSearchStore family of data stores, you can retrieve google search results in JSON format, and display them on your site directly.

Pause a second…. let it sink in…..

There are no cross domain issues, and no server side component is required. It uses the dojo.io.script transport to access the Google Ajax API service. Just stick the following on your page:

<div dojoType=”dojox.data.GoogleWebSearchStore” jsID=”googleStore”></div>

and you have Google’s millions of servers at your fingertips.

The following data stores are available:

  • GoogleWebSearchStore - does a standard web search.
  • GoogleBlogSearchStore - searches blogs. A future enhancement I will be writing will be to write a data store that accesses Google’s extremely cool Ajax Feed API, which provides access to any ATOM feed, anywhere, in JSON. It’ll be possible to do a full web search of all blogs for certain topics, then using the feed store to pull down that complete feed .
  • GoogleLocalSearchStore - searches the Google Local service to find places, businesses etc.
  • GoogleVideoSearchStore - Does what it says on the tin, searches for videos.
  • GoogleNewsSearchStore - Finds news stories…. noticing a pattern yet?
  • GoogleBookSearchStore - Um, finds books..
  • GoogleImageSearchStore - Finds images. This provides both a thumbnail and full sized version, similar to the FlickrRestStore already provided by Dojo.

The potential applications are more or less infinite. Demos included in the check-in show how to integrate this with the extremely cool dojox.dtl templating engine to display the results in a number of different ways, as well as how to feed the results into the Dojo Grid, Gallery and SlideShow.

This code is included in the nightly checkouts of Dojo, and not in v1.1. To get it, either check it out from source control, or get it from http://archive.dojotoolkit.org/nightly/.

Have a look at the simplistic demo of it in action at http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/data/demos/demo_GoogleSearchStore.html (available from the May 1st nightlies).

A big thank you to Google for making this service available. Now go play!

P.S. Stay tuned for the Yahoo variant, coming soon!

10 Responses to “Google and Dojo, Sitting in a tree…”

  1. Alex Russell Says:

    So. Freaking. Cool.

    Nice work!

  2. Shane O'Sullivan Says:

    Thanks Alex :-)

  3. Bob Says:

    Cool, but Google Feed Ajax API Data Store shoule be more useful. Can not wait for it..

  4. Shane O'Sullivan Says:

    It’s coming!

  5. Jose Noheda Says:

    Really useful! Well done

  6. Shane O'Sullivan Says:

    Thanks Jose!

  7. Google and Dojo, F.E.E.D.I.N.G « SOS Says:

    [...] Posts Google and Dojo, Sitting in a tree…Introducing the new Dojo Image WidgetsDojo Ajax Demo Engine releasedSexy new Calendar widget for [...]

  8. Will Says:

    I can’t wait to try hooking it up to a dijit.form.FilteringSelect widget.

  9. Shane O'Sullivan Says:

    Bob, The feed store is in - http://shaneosullivan.wordpress.com/2008/05/06/google-and-dojo-feeding/

    Shane

  10. New Demos for Dojo & Google search engine online « SOS Says:

    [...] componentsFlickr and Dojo Image GalleryWriting a Django Template Widget With Dojo Data StoresGoogle and Dojo, Sitting in a tree…Google and Dojo, [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>