Wednesday, November 15, 2006

DITA Search and Firefox plugin!

Since Chris Chiasson and David Cramer built custom search engines for DocBook, I thought it might be useful to create one for DITA, too! I frequently search the Language Specification, and it would also be handy to search the mailing archives. To that end, I present my custom Google Co-op search: DITA Search!

The DITA Search homepage is available here: http://www.google.com/coop/cse?cx=015401811188033694464%3Ahu_dvbft4pu

If you would like to have a search plugin for your browser, save the following as an xml file to your C:\Documents and Settings\username\Application Data\Mozilla\Firefox\Profiles\profilename\searchplugins directory:

<?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>DITA Search</ShortName>
  <Description>Search DITA1.0 Language Specification, DITA Wiki, DITA Focus Area and more! </Description>
  <Contact>scottys.log@gmail.com</Contact>
  <Developer>Scott Hudson</Developer>
  <LongName>DITA Search</LongName>
  <SyndicationRight>open</SyndicationRight>
  <AdultContent>false</AdultContent>
  <Language>en-us</Language>
  <OutputEncoding>UTF-8</OutputEncoding>
  <InputEncoding>UTF-8</InputEncoding>

  <Url type="text/html" method="GET" template="http://www.google.com/custom?cx=015401811188033694464:hu_dvbft4pu&q={searchTerms}&sa=Search&cof=CX%3ADITA%2520Search%3BFORID%3A0&hl=en&client=google-coop" /> 
</OpenSearchDescription>
Add to Google

I've also created a DITA Documentation search (lang spec, toolkit, other official docs) here: http://www.google.com/coop/cse?cx=015401811188033694464%3Acm02go-4hv8

Here's the plugin code for DITA Documentation:

<?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>DITA Documentation</ShortName>
  <Description>Search DITA1.0 Language Specification, DITA OT, and other official docs.</Description>
  <Contact>scottys.log@gmail.com</Contact>
  <Developer>Scott Hudson</Developer>
  <LongName>DITA Official Documentation Search</LongName>
  <SyndicationRight>open</SyndicationRight>
  <AdultContent>false</AdultContent>
  <Language>en-us</Language>
  <OutputEncoding>UTF-8</OutputEncoding>
  <InputEncoding>UTF-8</InputEncoding>

  <Url type="text/html" method="GET" template="http://www.google.com/coop/cse?cx=015401811188033694464%3Acm02go-4hv8&q={searchTerms}&sa=Search&cof=CX%3ADITA%2520Docs%3BFORID%3A0&hl=en&client=google-coop" /> 
</OpenSearchDescription>
Add to Google

Enjoy!

NOTE: you must change the & to &amp; in the Url template string...

Categories:

4 comments:

Anonymous said...

Scott:

What a wonderful idea. I'll be sure to blog about this opn my site, TheContentWrangler.com.

One question ... I'm on a Mac, so how do I load the plug-in into FireFox? And, are you considering adding this plug-in to the list of Firefox plug-ins available on the Mozilla site?

Thanks again. Let me know!

Scott Abel
TheContentWrangler.com
abelsp at netdirect dot net

Scott Hudson said...

Hi Scott,

I've tested this on my Mac as well. You follow the same procedure, by creating the XML file and posting it in your Firefox profile directory. I'm not in front of my iMac at the moment, but I think it's in the Libraries/Application Support/Firefox/Profiles/[profilename]/searchplugins
directory.

I've considered submitting the plugin to the mycroft site, but wanted to show folks the code, so they would know how to create their own custom plugins, too!

Best regards,

--Scott

Danny Zacharias said...

I used your example and customized it for my google custom search, but it did not work (I'm on a mac as well).

Also, how would I make this into an actual plugin and submit it to mycroft?

Danny

Scott Hudson said...

Hi Danny,
did you make sure to convert all of the & characters to &amp;?

As for submitting to mycroft, I think you just have to save the file as a .src and upload. I just haven't taken the time to try it yet.

--Scott