Google AJAX Search on the iPhone

July 24, 2007



Yesterday was an exciting day for us over here on the Google AJAX Search API team. At 6:00 a.m. I flipped a bit on our servers, opening up Image Search as the newest addition to this very powerful, and increasingly popular API.

We built several samples that highlight this new capability, including a sample designed specifically for the iPhone.

The blogsphere is definitely buzzing about this sample so I think it's appropriate that I contribute as well. A few key points follow:

  • URL: http://www.google.com/uds/samples/iphone/isearch.html
  • The iPhone sample is code that any developer can view in source form, copy, clone, modify, etc. Any developer can apply techniques taught in the sample to their own web sites and applications
  • The iPhone sample is optimized for the iPhone in a number of very subtle ways:
  • We used the Raw Searcher Layer which is fully documented and is the base layer used in all of our advanced search controls
  • We followed the iPhone web-development guidelines published by Apple
  • We designed the sample to be readable on the 320x480 device without the need for excessive zooming
  • We positioned the various controls to account for the size and accuracy of the human finger
  • We took advantage of the fact that the iPhone keyboard will adapt itself to the "type" of input control (note the search button in the bottom right of the keyboard)
  • We used an appropriate link target to ensure that links open on a new page leaving the search page intact and ready for another search
Why do we write samples like this?

The AJAX Search API is designed for developers. When your applications can take advantage of search, we provide you with everything you need in order to seamlessly integrate that search experience onto your site. You can control size, position, color scheme, searcher mix, result fidelity, etc.

The iPhone is a very popular device and it's getting a lot of developer attention at the moment. We built this sample to educate our developers and demonstrate our commitment to supporting the AJAX Search API on the popular platforms they're currently targeting.

Many people are now using this sample as a primary search page on the iPhone. I think that's a great use of the sample, that's exactly how I use it, and that's why at 1:30 a.m. this morning I made a minor update to the sample to include Blog Search results in addition to Web, News, and Image search results...

The thing to keep in mind though, is that this is not the primary goal of the sample. The real goal is to educate the iPhone developer community so that they see how easy it is to incorporate Google AJAX Search into their iPhone-based web applications. The AJAX Search API offers a large number of features, including full support for Custom Search Engines, various forms of site-restricted search, a variety of advanced UI controls, etc. All of this functionality is available on the iPhone as well as the other popular browser and OS combinations that all of you are currently targeting.

The iPhone search sample is designed to show you what's possible. It was built in a matter of hours and is less that 175 lines of code. We'd love nothing more than to see pieces of this code appearing, well-integrated, into your applications.

If you don't have an iPhone, but want to know what this is all about, the iPhone sample is running below: