Google Custom Search’s Planet Code4Lib as an OpenSearch Plugin

Posted on 2 minute read

× This article was imported from this blog's previous content management system (WordPress), and may have errors in formatting and functionality. If you find these errors are a significant barrier to understanding the article, please let me know.

Earlier I mentioned creating a Google Custom Search for Planet Code4Lib. The Google-supplied markup puts a form on your web page that leads to Google's server farm. (Alternatively, you can create a custom URL that points to an HTML page at Google which contains the form.) Well, that's really neat, but not far enough. How about an OpenSearch plugin suitable for Firefox and MSIE7? Here is the plugin markup:

< ?xml version="1.0" encoding="UTF-8"?>
 <opensearchdescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
   <shortname>Planet Code4Lib</shortname>
   <description>Search the bloggers of Planet Code4Lib using Google Custom Search.</description>
   <inputencoding>UTF-8</inputencoding>
   <tags>code4lib library</tags>
   <contact>peter@OhioLINK.edu</contact>
   <url type="text/html" template="http://www.google.com/cse?q={searchTerms}&amp;cx=017716194421589436379:zdoxzpetaxk&amp;sa=Search&amp;cof=FORID:0">
      <image height="16" width="16" type="image/png">
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRF////s7OzNDQ0SkpKioqKbGxsoaGhe3t7KSkp6enpWFhYHR0dzMzMl5eXYmJivr6+8/PzPj4+2traAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVWdikQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAI1JREFUKFNVTlsCwyAIE0SMLdSV+x92WLuP5SvmISnlgQLgTTcui/gTMGLi52oSDKMUzFbagQ/CXDqO4zEjwMMO0AihImJmQWEUYdOlwEhpLpC6a80KX04JlV75fC4Za8LvFu9hELmotva+TyfvK/RO5ZZ1Zkplb00q1b2pyI50lpafc9bW8ATdy2l1+1/rhQUihcZntwAAAABJRU5ErkJggg==</image>
      <adultcontent>false</adultcontent>
      <moz :searchform>http://dltj.org/2006/10/google-custom-search-for-planet-code4lib/
   </moz></url>
</opensearchdescription>

Pretty neat, eh? This link will install the search definition in Firefox and MSIE7.

Is this going too far?

One can't help but to wonder whether this violates the Google Custom Search Terms of Service. Here is a piece of 1.1 Description of Service.

For purposes of the Terms of Use, "Site" shall mean the Web site or sites on which You place JavaScript or similar programming ("Code") which renders the Google search box (or other means used by users of the Site ("End Users") to enter a search query ("Query")) on the Site ("Search Box"). All Queries sent from the Site to Google shall comply with the technical specifications that Google may provide from time to time, and and must originate from the Site.

So I'm not really using JavaScript, but I am using XML markup. Can "Site" mean the user's web browser interface? Further on in the ToS:

1.3 Your Obligations.
You shall receive a Query from the End User and shall forward that Query
to Google. You may not in any way frame or cache the Results produced
by Google, except as otherwise agreed to between You and Google. Google
will not be responsible for receiving Queries from End Users or for
transmission of data between You and Google's network interface. You
shall be responsible for providing all hardware and software required
to perform Your obligations under the Terms of Use, including but not
limited to the following: (a) implementing and maintaining the Site,
(b) implementing and maintaining the interface between the Site and
the Service, and (c) receiving a Query from an End User and transmitting
the Query to Google.

So with the search plugin, I'm not receiving the query — rather I'm facilitating the process of forwarding the query from the user's browser to Google. So far, so good, I think. The search plugin doesn't frame or cache the results; I'm okay with that clause. With regard to my obligations, I'll maintain DLTJ as the source of the OpenSearch XML configuration file (unless someone wants to put it directly on code4lib.org somewhere), but again DLTJ is not sitting between the end user and Google so I don't think points (b) and (c) apply.

Too much legalese. In the spirit of mashups everywhere, I'll put this out and ask for forgiveness if it violates Google's sensibilities rather than asking for permission first.