Firefox 2.x and IE 7.0 Search Plugins

I wanted a search plugin for dict.org as it is a nice, simple dictionary without lots of blinky crap. I've found the plugin before, but I couldn't this time... this time I created it myself!

http://searchy.protecus.de/en/mkxml.php?id=1130 -- link to the searchy created dict.org opensearch fragment. try save link as. Firefox 2.0 crashed when I load that URL manually and attempt to right-click and "Save Page As..."

better than that, try this : add dict.org search plugin

why isn't the above active?? That would fall under "autodiscovery fo search plugins" and the link element needs to go in the head section of the HTML document. Actually, the "link rel" element probably did work -- click on the drop down list of search providers and see if there is an item near the bottom named 'Add "Dict.org Search Plugin: By km44"'. That falls under 'autodiscovery of search plugins'.

Alternately, you can use a javascript: href or an input element, like so :

That works for firefox 2.x and IE 7.0.x. The link and the button point to an xml file that contains the following :

<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
    <InputEncoding>ISO-8859-1</InputEncoding>
    <ShortName>dict</ShortName> 
    <Description>Search with dict</Description>
    <Url type="text/html" template="http://www.dict.org/bin/Dict?Query={searchTerms}&amp;Strategy=*&amp;Database=*&amp;Form=Dict1" /> 
</OpenSearchDescription> 

see also :

Forgot to mention how to put icons in the XML -- add an Image element. It is just an image/xicon data (the same as favicon.ico). Once you have a favicon.ico, you can run these commands to convert it to text data. Copy and paste the complete Image element into your xml file. :

echo -n '<Image width="16" height="16">data:image/xicon,' ; perl -ne 's/(.)/"%".unpack("H2",$1)/egs; print' /tmp/favicon.ico ; echo '</Image>'

Now, can I create a firefox 1.x and 2.x compatible search plugin?


Firefox 1.x Search Plugins

Here is the firefox 1.x version of the dict.org search plugin :

Install dict.org search plugin for firefox 1.x
Install staff directory search-by-last-name plugin for firefox 1.x

That searches by last name only. However, it is possible to use percent signs (%) as wild cards in the search... I wonder if they filter out other sql bits... it doesn't look good : o% returns a number of records starting with "o'". o'boyle returns "sorry no matches". o''boyle returns the expected result.

That works! (Even on firefox 2.x)

Firefox 1.x search. Looks easier than opensearch in some ways, but not as clear in other ways. I don't see where the search term goes in it. The trick to 1.x and 2.x is the addSearchEngine() From a second example, it looks like the trick with 1.x is that you create a <search> element and it contains input elements. the element with a pseudo-value of "user" is the one that gets the search term.

http://mycroft.mozdev.org/deepdocs/quickstart.html
This is *the* reference doc for the 1.x style search plugin. They *do* cover all the the foolish little attributes that you want to include in your search element and what to put in them! Event better, the quickstart has links to more extensive documentation on how to fill in the elements. Including recommendations on how to install the search plugins. A number of the sites I found use the mycroft reference code almost as is.

"Mycroft search plugins" are extended versions of Apple's Sherlock search standard.

So, what I would need for dict.org? The URL is:

http://www.dict.org/bin/Dict?Query=snowflake&Strategy=*&Database=*&Form=Dict1

which translates to

	<search
	   version="9.1"
	   name="dict.org"
	   description="dict.org search plugin"
	   searchform="http://www.dict.org/"
	   method="GET"
	   action="http://www.dict.org/bin/Dict"
	   queryCharset="ISO-8859-1"
	>
	<input name="Query" user>
	<input name="Strategy" value="*">
	<input name="Database" value="*">
	<input name="Form" value="Dict1">
	</search>

Then getting a gif of the dict.org favicon.ico...

     % GET http://www.dict.org/favicon.ico > icon-dict.org.ico
     % identify icon-dict.org.ico
     icon-dict.org.ico[0] ICO 16x16 DirectClass 8-bit 1078b 0.0u 0:01
     icon-dict.org.ico[1] ICO 32x32 DirectClass 8-bit 1078b 0.0u 0:01
     # I only want the 16x16. Just converting to gif, makes it animated...
     # specify the frame with [0]...
     % convert icon-dict.org.ico\[0\] icon-dict.org.gif
     % identify icon-dict.org.gif
     icon-dict.org.gif GIF 16x16+0+0 PseudoClass 16c 8-bit 256b 0.0u 0:01

Put the search element in search1x-dict.org.src and the icon in search1x-dict.org.gif, then use the following javascript link to install the search plugin :

<a href="javascript:window.sidebar.addSearchEngine('http://www.cs.cmu.edu/~km44/search1x-dict.org.src', 'http://www.cs.cmu.edu/~km44/search1x-dict.org.gif', 'dict.org search plugin for firefox 1.x', 'Web');">Install dict.org search plugin for firefox 1.x</a>

for more reference see :


This is pretty easy once you get going on it... information for the university fac/staff directory search :

Working URL :

https://acis.as.cmu.edu/hris/secure/proc.formproc?VAR1=marshall&VAR2=&VAR3=&VAR4=*&VAR5=*&FUNCNAME=fsd_main&PORT=1&ARGNUM=5

Form Details :

	search form URL = https://acis.as.cmu.edu/hris/secure/lookup.htm
	query URL = https://acis.as.cmu.edu/hris/secure/proc.formproc
	FUNCNAME=fsd_main
	PORT=1
	ARGNUM=5
	VAR1=lastname
	VAR2=firstname      (leave blank if not specified)
	VAR3=userid         (leave blank if not specified)
	VAR4=relationship   (use a *)
	VAR5=department     (use a *)

that shouldn't be too hard to work into a search plugin... Oh, and from the docs on opensearch, firefox 2.x has the ability to do POST operations, IE7 reportedly can only do GET. firefox 1.x can only do GET operations.