Ubiquity and Tahiti: Together At Last!

Aug 29, 2008 / By Don Seiler

Tags: , ,

Almost everyone and their mum has been twittering about (or from) Mozilla Labs’ newest creation, Ubiquity. You can get a quick introduction of this firefox extension via their blog post, which has a video tour.

Well, after playing around with the simple stock commands (email, wikipedia search, twittering), I decided it was time for a handy Oracle search function. I emerged from my cave with a pretty basic Ubiquity command that will search the tahiti documentation, and optionally search the documentation for a specific version of Oracle from 9iR2 onward. Right now it will simply take you to the Oracle search results page. If I find that Oracle is providing an API to the tahiti search engine, I may enhance it to include results in the Ubiquity preview pane.

You can load the command in your Ubiquity-enabled browser by visiting this page. Ubiquity users should already see the notice at the top of the page to subscribe to this command. You can view the source code at the end of this post.

Once the command is loaded, open Ubiquity via the hotkeys (alt+space or ctrl+space by default) and type something like “tahiti create database”, then hit Enter. This will take you to the tahiti search results page for “create database” for all versions. If you know you just want the results for 10gR2, type “tahiti create database in 10gR2″ and you’ll be taken directly to those results. Supported versions are 9iR2, 10gR1, 10gR2 and 11gR1. If you leave out the revision (Rn), it will assume the latest revision for that version (e.g. 10g = 10gR2).

Here is a screenshot of some serious ubiquitous action:
Screenshot of Ubiquity and Tahiti command

Here is the source code:

CmdUtils.CreateCommand({
  name: "tahiti",
  homepage: "http://www.pythian.com/",
  author: { name: "Don Seiler", email: "seiler@pythian.com"},
  license: "GPLv2",
  description: "Executes search of Oracle RDBMS documentation.",
  help: "Specify search terms and version (9iR2, 10gR1, 10gR2, 11gR1).  If no version is specified, or specified version is not recognized, all version will be searched.  Specifying a version without a revision will default to the latest revision.",
  takes: {"search term": noun_arb_text},
  modifiers: {in: noun_arb_text},

  preview: function( pblock, term, mods ) {
    var msg = 'Searches tahiti in {$in} for "{$term}".';
    var subs = {term: term.text, in: mods.in.text};

    pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
  },

  execute: function( term, mods) {
    var searchterm = term.text || CmdUtils.getTextSelection();
    var urlDefault = "http://www.oracle.com/pls/db102/print_hit_summary?search_string={TERM}";
    var url9iR2 = "http://www.oracle.com/pls/db92/db92.drilldown?word={TERM}";
    var url10gR1 = "http://www.oracle.com/pls/db10g/search?word={TERM}";
    var url10gR2 = "http://www.oracle.com/pls/db102/search?word={TERM}";
    var url11gR1 = "http://www.oracle.com/pls/db111/search?word={TERM}";

    var version = mods.in.text || '';
    version = version.toLowerCase();

    var url = '';
    switch(version) {
      case '9i':
      case '9ir2':
        url = url9iR2;
        break;
      case '10gr1':
        url = url10gR1;
        break;
      case '10g':
      case '10gr2':
        url = url10gR2;
        break;
      case '11g':
      case '11gr1':
        url = url11gR1;
        break;
      default:
        url = urlDefault; // Default to all version tahiti search
    }

    url = url.replace("{TERM}", searchterm);
    Utils.openUrlInBrowser(url);
  }
})

4 Responses to “Ubiquity and Tahiti: Together At Last!”

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>