Google AJAX Search API
The Google AJAX Search API provides simple web objects that perform inline searches over a number of Google services (Web Search, Local Search, Video Search, Blog Search, News Search, and Book Search). The API is designed to allow copying search results directly into user messages.
Pre requirements for developers:
programming and object-oriented programming concepts.
Based on Technologies:
The search control can be programmed to display in different draw modes:
Another common option available is the ability to decouple the "search form" from the set of search results.
The following searcher objects (services) are currently supported:
- Google Local Search
- Google Web Search
- Google Video Search
- Google blog Search
- Google news Search
- Google book Search
Given that the Google AJAX Search API is a work in progress, the list of supported services will evolve over time.
The expansion mode may be one of the following:
- Open - results are displayed as fully as possible within the object
- Closed - results are hidden from view, unless opened through use of a UI element (e.g. an arrow).
- Partial - results are shown as a subset of the "open" expansion mode
The Google AJAX Search API is designed to allow users to distribute search results to others, primarily through content creation applications like blog posts, message boards, etc.
Search results object contains a number of searcher specific properties, as well as a uniform html property that contains an HTML element representing the entire search result. The simplest way to handle the callback is to clone the html node and attach it to a node in your application's DOM.
- Setting Site Restrictions
In some situations, you might want to restrict a web search, news search, or blog search to a specific site or blog. When you apply restrictions like this, you would typically also want to set your own custom label on the associated section of search results, and you might want to style this section of results differently.
All of these capabilities are supported by using a combination of methods exposed by the searcher options.
In some situations, you want to use the search control because it provides all the UI that you need, but you have a need to see and partially process search results as they arrive. Instead of resorting to the GSearch layer where you have this capability, but are then responsible for the UI, the search control exposes a pair of callbacks. You can use these to request notification before a search executes, and after a search completes. Note, you can not count on a given execute resulting in a completion. The completion may never occur, so don't code yourself into a deadlock. A typical example if this occurs when you might want to plot local search results on a nearby map.
Form provides a text input element, a search button, a clear button, as well as "google branding". If your application is not using the search control, and instead is using the raw GSearch layer, the GSearchForm
() object is designed just for you... Using this object, you get all of the advantages and branding of the search form thats integrated into the search control, but packaged as a standalone object that you control both behavior and placement.
When using the GSearchControl
, or the GSearchForm
, your users are naturally exposed to "powered by Google" branding. They are able to associate the search services exposed by your site with Google. When your application does not use either of these forms, it is important to still communicate the Google brand to your users. The GSearch.getBranding() method is designed to help you with this. This method accepts an HTML DOM element and attaches the "powered by Google" branding into that element. Alternatively, a "powered by Google" HTML DOM element can be returned to you so that you can attach it directly.
Each search result includes a default .html property that is built with CSS styling in mind. As a result, each piece of semantic information is enclosed in HTML markup with an appropriate set of class markers. This allows to use this HTML in conjunction with custom CSS rules that style the HTML.
For detailed information on each search result's CSS structure, visit the following section.
The Google AJAX Search API currently supports Firefox 1.5+, IE 6, and Safari, and Opera 9+.
Is it open source?
To use the API, you need to sign up for an API key.
Category AJAX Frameworks