Google Ajax Search API Srikanth TSS. Google AJAX Search API Lets you put Google Search in your web pages with JavaScript. Embed a simple, dynamic search.

Slides:



Advertisements
Similar presentations
Using EBSCOs Search Box Builder Tool Tutorial. Would you like to promote your EBSCOhost resources by adding an easy-to-use search box to your website?
Advertisements

Samsung Smart TV is a web-based application running on an application engine installed on digital TVs connected to the Internet.
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
What is jQuery Mobile? How to use it? Doncho Minkov Telerik Corporation Technical Trainer.
JavaScript and AJAX Jonathan Foss University of Warwick
NEXT. Create Pages in Blogger Another top user-requested feature has just graduated from Blogger In Draft! Blogger now makes it easy to create Pages linked.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Web Page Behavior IS 373—Web Standards Todd Will.
Dynamic Web Pages Bert Wachsmuth. Review  Internet, IP addresses, ports, client-server, http, smtp  HTML, XHTML, XML  Style Sheets, external, internal,
WikiPlus customizations
PART III – MAKING YOUR BLOG DYNAMIC Adding Polls, Video Bars, Feeds, News Reels, and Cluster Maps. Also, learn how to embed video, audio, and documents.
ICS 665 Jesse Abdul. jQuery UI Overview  jQuery UI javascript library Includes all UI component functionality  jQuery UI CSS framework Includes standard.
6 th Annual Focus Users’ Conference Application Editor and Form Builder Presented by: Mike Morris.
Selenium – Testing Tool. What is Selenium? Selenium is a robust set of tools that supports rapid development of test automation for web-based applications.
1 Agenda Overview Review Roles Lists Libraries Columns.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Definition from Wikipedia.  The Prototype JavaScript Framework  implemented as a single file of JavaScript code  named prototype.js (
IMAGES Controlling size of images in CSS Aligning images in CSS Adding background images.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
® IBM Software Group © 2006 IBM Corporation JSF Tab Controls This Learning Module shows how to develop server-side EGL applications with dynamic content.
CST JavaScript Validating Form Data with JavaScript.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
Forms and Form Controls Chapter What is a Form?
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Lirida Kerçelli Ayşe Sezer The Google AJAX Search API.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Creating Effective School and PTA Websites Sam Farnsworth Utah PTA Technology Specialist
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
Office of Educational Technology School District of Philadelphia Introduction to Sites Google Sites This presentation is available at
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
HTML Forms.
HTML Basics BCIS 3680 Enterprise Programming. Web Client/Server Architecture 2  Your browser (the client) requests a Web page from a remote computer.
JavaScript - A Web Script Language Fred Durao
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Designer Basics.
Web Development 101 Presented by John Valance
Using Ajax to Improve uPortal User Experience Jen Bourey Yale University
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
Engineering\CADD Systems Office CADD Manager's Series Customizing the Interface.
Introduction to Views Stanford Drupal Camp April 6, 2013.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
Creating Google Sites Laura Assem, Director of Technology.
What is Voice Thread? VoiceThread is an application that runs inside your web browser, so there is no software to download, install, or update. VoiceThread.
January 2006Colby College ITS Setting Up Course Pages.
Online Surveys Jacqui James Malcolm Roberts School of Education.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
Transportation Agenda 187. Transportation About Web Parts Web parts are reusable “containers” that reside on web pages and interact with lists, libraries.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
Beginning ASP.NET in C# and VB Chapter 9
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
Tutorial 6 Creating a Web Form
Here are some things you can do while you wait 1.Open your omeka.net site in your browser (e.g. 2.Open.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Sitecore Basic Training Content Management System (CMS) University Communications Web Services
Weebly is Your Friend. * To Enhance And Promote Your Curriculum * To Provide A Student Resource * Add Efficiency to Your Planning * Informational * Promote.
DHTML.
JavaScript, Sixth Edition
JavaScript and Ajax (Ajax Tutorial)
Creating Oracle Business Intelligence Interactive Dashboards
Part 2 Setting up a web server the easy way
Download from Zotero Home Page
Presentation transcript:

Google Ajax Search API Srikanth TSS

Google AJAX Search API Lets you put Google Search in your web pages with JavaScript. Embed a simple, dynamic search box and display search results in your own web pages.

Uses Provides simple web objects that perform inline searches Build powerful web apps on top of Google search

How to use it? Include the URL for the Google AJAX Search API javascript library ( ds.js&v=1.0&key=ABCDEFG). This library includes objects and symbols for placing Google Search API results on your pages.

Sign up for the Google AJAX Search API A single AJAX Search API key is valid within a single directory on your web server, including any subdirectories. Signing up the URL will create a key usable within all URLs in that directory.

What else do I need? You must have a Google Account to obtain a Google API key, and your API key is tied directly to your Google Account.Google Account You can generate multiple API keys for your account if you have multiple web sites.

API Overview The Google AJAX Search API is made up of several classes of objects: GSearchControl - This class provides the user interface and coordination over a number of searcher objects, where each searcher object is designed to perform searches and return a specific class of results (Web Search, Local Search, etc.). GSearch - This base class is the class from which all "searchers" inherit. It defines the interface that all searcher services must implement. GResult - This base class encapsulates the search results produced by the searcher objects. GsearchOptions - This class configures the behavior of searcher objects when added to a search control.

Example function OnLoad() { var searchControl = new GSearchControl(); searchControl.addSearcher(new GwebSearch()); searchControl.addSearcher(new GvideoSearch()); searchControl.addSearcher(new GblogSearch()); searchControl.addSearcher(new GnewsSearch()); searchControl.addSearcher(new GbookSearch());

Example (contd.) var localSearch = new GlocalSearch(); searchControl.addSearcher(localSearch); localSearch.setCenterPoint("New York, NY"); searchControl.draw(document.getElementById("searchcontrol")) ; searchControl.execute(“Google API"); } GSearch.setOnLoadCallback(OnLoad); Loading

HTML in detail Main object is an instance of GSearchControl, GSearchControl coordinates search across a collection of search services Search services are child objects GlocalSearch, GwebSearch GvideoSearch, GblogSearch GnewsSearch, and GbookSearch addSearcher() method – Adds Children to the object.

HTML in detail (contd.) draw() - Search control displays itself within the web page; Also binds the search control onto your page. By default, a search control draws in a "linear" layout; Can also be a "tabbed" layout. Allows decoupling "search form" from search results. Search form in the sidebar ; Results stacked in the center of the page.

HTML in detail (contd.) User initiates search by entering search terms into the search control's text field. Automatically begins parallel search across requested Google services. Initiate a search by calling execute() method, passing an argument.

Browser Compatibility The Google AJAX Search API currently support Firefox 1.5+, IE 6, and Safari, and Opera 9+.

GSearcherControl Draw Modes var drawOptions = new GdrawOptions(); drawOptions.setDrawMode(GSearchControl.DRAW_MODE_LINEAR); searchControl.draw(element, drawOptions); GdrawOptions object - Controls search results to be displayed in different draw modes using setDrawMode() method GSearchControl.DRAW_MODE_LINEAR GSearchControl.DRAW_MODE_TABBED

GSearcherControl Draw Modes (contd.) Ability to decouple the “search form” from “search results” var drawOptions = new GdrawOptions(); drawOptions.setSearchFormRoot(document.getElementById("sForm")); searchControl.draw(element, drawOptions); setSearchFormRoot() - This method accepts a DOM element which will act as the container for the search form.

Searcher Objects - setExpandMode var options = new GsearcherOptions(); options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN); searchControl.addSearcher(new GwebSearch(), options); addSearcher() – This method determines which search services the search control operates Takes two arguments, One - specifies the service object Two - specifying options for the service Argument One – GlocalSearch, GwebSearch, GvideoSearch, GblogSearch, GnewsSearch,GbookSearch

Searcher Objects – setExpandMode (contd.) Argument Two – Controls each service's default expansion mode GsearchControl.EXPAND_MODE_OPEN Results are displayed as fully as possible within the object GSearchControl.EXPAND_MODE_CLOSED Results are hidden from view, unless opened through use of a UI element (e.g. an arrow). GSearchControl.EXPAND_MODE_PARTIAL Results are shown as a subset of the "open" expansion mode

Searcher Objects - setRoot var options = new GsearcherOptions(); options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN); options.setRoot(document.getElementById(“localform")); searchControl.addSearcher(new GlocalSearch(), options); When it is desirable to project search results for a given service (here local search) into a different location on the web page.

Storing a Search Result Google AJAX Search API is designed to store results to another application. setOnKeepCallback() – Using this method, applications specify an object and method that is called whenever a user clicks "Copy" link below the result.

Storing a Search Result (contd.) searchControl.setOnKeepCallback(this, MyKeepHandler); function MyKeepHandler(Gresult) { var node = Gresult.html.cloneNode(true); var savedResults = document.getElementById(“SavedResults"); savedResults.appendChild(node); } When a user clicks the link, Registered callback receives a GResult instance representing the search result. Search results object contains searcher specific properties, as well as a uniform html property that contains an HTML element representing the entire search result. Clone the html node and attach it to a node in your application's DOM.

Setting Site Restrictions To restrict a web search, news search, or blog search to a specific site or blog. To set your own custom label on a section of search results To style a section of results differently. Supported by.setUserDefinedLabel().setUserDefinedClassSuffix().setSiteRestriction() Example. Return results from amazon.com "Amazon.com" as the search section label Apply custom css styling to this section (bold title, orange keeper button, etc.).

Setting Site Restrictions (contd.).gsc-resultsRoot-siteSearch.gsc-keeper { background-image : url('../../css/orange_check.gif'); font-weight : bold; }.gsc-resultsRoot-siteSearch.gsc-title { font-weight : bold; } var searchControl = new GSearchControl(); var siteSearch = new GwebSearch(); siteSearch.setUserDefinedLabel("Amazon.com"); siteSearch.setUserDefinedClassSuffix("siteSearch"); siteSearch.setSiteRestriction("amazon.com"); searchControl.addSearcher(siteSearch);

Reference /documentation/reference.html /documentation/reference.html

Thank you!