New Feature: Site Restricted Search

June 7, 2006

We launched the Google AJAX Search API as a Version 0.1 API so that we could take a little bit of time to gather feedback from you. We welcome feedback on the current API as well as suggest features that we could add that would make your lives easier.

One suggestion that we have heard from many of you concerns site restricted searching. You wanted to be able to implement a "Search my site", "Search the web" quickly, easily, and with professional results and styling.

This afternoon, we updated the service to include a handful of new methods, documentation, and samples that should get you pointed in the right direction.

For all searchers, you now have the ability to set a user defined label for a specific searcher. This lets you replace the current system defined label of "Web", "Blog", etc., with a label of your choice e.g., "My Site", "Amazon.com", etc. Since you might want to provide unique styling for this searcher, we also added a new method that allows you to specify a user defined class suffix to wrap the results for any searcher. This is a pretty advanced feature, but for those of you that have a knack for CSS, you will appreciate the cool new things this allows you to do. And yes, our new sample application uses this...

Finally, for site restrictions, the GwebSearch and GblogSearch classes now support a .setSiteRestriction() method that forces search results to be scoped based on the programmed restriction. Our sample application demonstrates the use of this by configuring a web searcher to only return results from Amazon, and by configuring a blog searcher to only return posts from the Live Journal Nintendo DS blog. Check out a sample.