Site Search

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 26 June 2007

Custom Search Engine APIs

Posted on 14:21 by Unknown
Posted by: Matt Wytock, Software Engineer

A couple of weeks ago we blogged about a new feature and a new kind of Custom Search Engine (CSE) that you could create on the fly. Today, we thought we'd dig a bit deeper and describe the underlying infrastructure that powers this. With our new Linked CSEs, we are exposing the API to create and control CSEs.

Until now, you created a CSE either by using the wizard or by writing an XML file and uploading it to Google (via the "Advanced" tab on the control panel). To change any aspect of the CSE, you had to either use the control panel or upload the new XML specification. This imposed several limitations:

  • Creating and maintaining a CSE was a manual process.
  • It was difficult to create a large number of CSEs.
  • It was difficult to use other data sources such as iCal, RSS, Google Base, etc. to programmatically create CSEs.

The search box code for these CSEs (found on the "Code" tab in the control panel) includes a "cx" parameter with every search request (for example, <input type="hidden" name="cx" value="005946352831473999820:qs1idu8ptku" />), which specifies an internal identifier for the CSE.

Linked CSEs overcome these limitations. In short, you can now specify your CSE using a "cref" parameter that points to a URL, anywhere on the web. You update this URL at your end and don't have to upload it or edit your CSE using our tools. The URL can take arguments to produce dynamic CSEs, based on the current page, the current user visiting your site, etc. You can see this in action on our "on the fly" demo page: when you type "http://www.cs.berkeley.edu/~russell/ai.html" in the form text field, the javascript on that page constructs a "cref" parameter that contains http://www.google.com/cse/tools/makecse?url=http://www.cs.berkeley.edu/~russell/ai.html. This URL (visit it!) contains an XML specification for a CSE. You can use any script you want, or reference a static file, when creating your CSE. And there's nothing special about our makecse example script: we're hoping that our developers and the developer community will build many other such CSE-generating tools.

How does this work? With Linked CSEs, you designate a CSE specification URL with each search request (as a hidden form field in your search box HTML code). Google retrieves the CSE specification from the URL when your user searches in the CSE. We cache and refresh the results so that only the first search to your CSE incurs any delay. The flexibility to specify how your search engine should behave, just when your user is doing the query, using whatever data sources you want, opens up many possibilities:

  • You can use our makecse tool to generate CSEs from different sources of links:
    • HTML: http://www.cs.berkeley/~russell/ai.html
    • RSS: http://reddit.com/.rss
    • ATOM: http://lipstadt.blogspot.com/feeds/posts/default
    • OPML: http://medicalconnectivity.com/gems/blogroll.opml
  • You can combine multiple sources of links using our makeannotations tool and the <Include> tag. For example, its easy to create a search engine from the links on the front pages of techmeme, slashdot and digg.
  • You can write your own tools to produce <Annotations /> XML from other data sources such as Google Calendar or iCal feeds, Google Base or any other structured source of information.
  • You can automatically generate any number of CSEs, each possibly tuned to a particular user. For example, we've created a sample that builds a CSE from a user's digg.com friend network and submissions using the Digg API. Try it out and view the source. This makes use of two simple python CGI scripts:
    • diggannos.py generates <Annotations> from the specified user's submitted stories
    • diggcse.py generates <GoogleCustomizations> from the specified user's friend network. For each friend, it generates an <Include> element pointing to the appropriate diggannos.py URL

You can test any Custom Search Engine XML by going to http://www.google.com/coop/cse/cref and entering the URL. Putting a search box on your site is as easy as copying a small bit of HTML code and modifying the "cref" parameter.

Linked CSEs are a very big step for Google Custom Search. We hope you will find them as cool as we do. As always, thank you for your support and keep the feedback coming.
Email ThisBlogThis!Share to XShare to Facebook
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Custom Search Engine APIs
    Posted by: Matt Wytock, Software Engineer A couple of weeks ago we blogged about a new feature and a new kind of Custom Search Engine (CS...
  • Connecting with the Adobe Community with Google Site Search
    Posted by: Tom Duerig, Software Engineer We love Google Site Search. And when working with our customers, we often discover new and interest...
  • Autocompletion of queries in Custom Search
    One of the most requested features for Custom Search is autocompletion of queries. Today, we announced at Google I/O that you can now enab...
  • Star Power
    Posted by: Jay Davies, Community Manager If you've created a Custom Search Engine you've likely encountered the term 'URL patter...
  • Ads background colors in Custom Search
    As we continue to improve the look and feel of Google Custom Search Engine (CSE), today we’re announcing a change in how ads are displayed ...
  • Ads now in harmony with search results
    Posted by: Tom Duerig, Software Engineer Many folks have pointed out that all the results on the page -- both the search results and the adv...
  • Bootstrapping your CSEs from keywords
    Custom Search provides upto 5000 URL patterns to define a “slice” of the web to search over. However, if you’re creating a Custom Search Eng...
  • Integrating Custom Search with your service
    Posted by: Kevin Gollum Lim, Technical Writer Most people who need something just go to the store to get the item, but a number of people ta...
  • Custom Search at the core of Google Site Search
    Posted by: Matt Wytock and Vrishali Wagle, Software Engineers Today, we announced Google Site Search , a hosted website search product that...
  • Custom Search promotions made easier
    Posted by: Bartlomiej Niechwiej and Nicholas Weininger, Software Engineers Last year, we made it easier to promote relevant information to ...

Blog Archive

  • ►  2013 (5)
    • ►  December (1)
    • ►  October (1)
    • ►  September (1)
    • ►  March (1)
    • ►  January (1)
  • ►  2012 (8)
    • ►  August (1)
    • ►  June (1)
    • ►  May (1)
    • ►  March (1)
    • ►  February (2)
    • ►  January (2)
  • ►  2011 (18)
    • ►  December (2)
    • ►  November (4)
    • ►  October (1)
    • ►  September (2)
    • ►  August (1)
    • ►  July (1)
    • ►  June (3)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2010 (14)
    • ►  December (1)
    • ►  November (2)
    • ►  October (1)
    • ►  September (1)
    • ►  August (1)
    • ►  May (1)
    • ►  April (3)
    • ►  March (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2009 (23)
    • ►  December (1)
    • ►  November (1)
    • ►  October (6)
    • ►  September (1)
    • ►  August (1)
    • ►  July (2)
    • ►  June (2)
    • ►  May (5)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2008 (18)
    • ►  December (1)
    • ►  November (1)
    • ►  October (2)
    • ►  September (3)
    • ►  August (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (1)
    • ►  March (3)
    • ►  February (2)
    • ►  January (1)
  • ▼  2007 (20)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  September (2)
    • ►  August (1)
    • ►  July (2)
    • ▼  June (3)
      • Custom Search Engine APIs
      • Finding your community
      • Custom Search on the fly
    • ►  May (1)
    • ►  April (1)
    • ►  March (2)
    • ►  February (3)
    • ►  January (2)
  • ►  2006 (9)
    • ►  December (2)
    • ►  November (7)
Powered by Blogger.

About Me

Unknown
View my complete profile