Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Complete Guide to Google Ajax Search API


Published on

Published in: Technology, News & Politics
  • Be the first to like this

Complete Guide to Google Ajax Search API

  1. 1. Complete Guide to Google Ajax Search API Explained by Rohit Ghatol [email_address]
  2. 2. Why use Google Ajax Search API? <ul><ul><li>Allow user to search on your site </li></ul></ul><ul><ul><li>Allow user to get categorized search results </li></ul></ul><ul><ul><li>Allow the search results to be restricted to a domian </li></ul></ul><ul><ul><li>Help user with recommended search key words </li></ul></ul><ul><ul><li>Show Video Bar, Book Bar, Blog bar and News Bar </li></ul></ul>
  3. 3. Getting Started <ul><ul><li>Get a Google Ajax Search API Key for your domain </li></ul></ul><ul><ul><li>Code for Categoried search results </li></ul></ul><ul><ul><li>Code for chaning look and feel and position of search results </li></ul></ul><ul><ul><li>Code for restricting Search results to a Domain </li></ul></ul><ul><ul><li>Code for adding Map Search, Video Search </li></ul></ul><ul><ul><li>How to use wizards for Book/Blog/Video/News Bar </li></ul></ul><ul><ul><li>How to setup a Custom Search Engine </li></ul></ul><ul><ul><li>Using the Custom Search Engine to refine search results </li></ul></ul>
  4. 4. Get the Key from this Page
  5. 5. Code for Categorized Search Result GSearchControl GwebSearch div with id “searchcontrol ”
  6. 6. Code for Categorized Search Result <html> <head> <script src=&quot;../../api?file=uds.js&amp;v=1.0&quot; type=&quot;text/javascript&quot;></script> <script type=&quot;text/javascript&quot;> //<![CDATA[ ...................... (see next slide) //]]> </script> </head> <body> <div id=&quot;searchcontrol&quot;>Loading</div> </body> </html>
  7. 7. Code for Categorized Search Result <script type=&quot;text/javascript&quot;> //<![CDATA[ function OnLoad() { // Create a search control var searchControl = new GSearchControl(); // Add in a full set of searchers var localSearch = new GlocalSearch(); searchControl.addSearcher(localSearch); searchControl.addSearcher(new GwebSearch()); searchControl.addSearcher(new GvideoSearch()); searchControl.addSearcher(new GblogSearch()); searchControl.addSearcher(new GnewsSearch()); searchControl.addSearcher(new GimageSearch()); searchControl.addSearcher(new GbookSearch()); // Set the Local Search center point localSearch.setCenterPoint(&quot;New York, NY&quot;); // tell the searcher to draw itself and tell it where to attach searchControl.draw(document.getElementById(&quot;searchcontrol&quot;)); // execute an inital search searchControl.execute(&quot;VW GTI&quot;); } GSearch.setOnLoadCallback(OnLoad); //]]> </script>