Wednesday, October 15, 2008

Installing and Creating Open Search Plugins

Ever since Firefox added its search plug-in feature, I've been trying to get plug-ins for the search sites I use the most. Search plug-ins are one more way to make using a computer a little more efficient. The Search bar is usually in the upper right hand of your browser. To search a site you simply click on the Search bar and select the plug-in you want to use from your list.

I believe all the browsers out today have this feature. Further, these browsers can all share the same search plug-ins because they use a standard called OpenSearch. There are plug-ins for all the major sites. Even if your favorite site doesn't have a plug-in, you can make your own.
Finding and installing plugins

Lifehacker did an article about installing plug-ins so I wont go into specifics. Usually, once you find a plug-in you want to add, there is a link you click to add the plug-in. Also, some sites will "broadcast" that they have a plug-in to add. These sites will insert an "add" menu item at the bottom of the plug-in list.


Several websites allow you to search for plug-ins for your favorite search site. The ones I've used are Mycroft at Mozzila and SearchPlugins.net. Even these plug-in sites have search plug-ins.

The Lifehacker article listed a few plug-ins that I find invaluable. Searches for:


  • gcalfavico.pngGCal (Firefox only)
    I have been experimenting with using google calendar for my legal calendaring, this plug-in allows me to search by client name without having to the Google calendar page.

  • gmailfavicon.pngGmail

  • gmapsfavicon.pngGoogle Maps

  • wikipediafavicon.pngWikipedia


About wikipedia, have you ever noticed that their search engine is sub par? Google does a much better job of searching wiki than wiki. Here's a search plug-in that only searches Wikipedia pages using Google.


Cornell provides plug-ins to search their site. Finally, I've been making my own search plug-ins for sites that don't provide one. So far, I've only done plug-ins for the South Dakota legislature site - most significantly, the codified laws. I use this plug-in every day and you find it here.

Making Search More Efficient
Firefox 3 has the ability to associate a keyword with a search plug-in. For example, I use "wiki" as the keyword for wikipedia. To use my keyword, I type "wiki" and the term I want to search for in the address bar.

To create a keyword, click on the search plug-in drop down. Then, select Manage Search Engines. In the Manage Search Engine List dialog, you can change the order that your engines are arranged in your list. More importantly, you can add a your keyword to a search plug-in by hitting the Edit Keyword button.



To make searching even more efficient, I use the keyboard shortcut Ctrl+l to automatically put the cursor in the address bar.

Creating Your Own Search Plug-In

Before continuing with my tradition of giving too much information, I must give the disclaimer. If you don't want to know how to create your own plug-in, don't read this.

The Mozilla Mycroft project makes it easy to create your own plug-ins with an Open Search generation page.
The best way to explain this is by an example. Lets create a plug-in to search the South Dakota Constitution.

The first step is to get an icon for the plug-in. I want to use the page's icon. Most websites have their icon in a file called favicon.ico. I can get to this on legis.state.sd.us with the address http://legis.state.sd.us/favicon.ico. Then I can save the file to my hard drive. Next, on the Mycroft page, I can browse to the file on the Choose Icon box.

Next fill in something for the Reference. I'm using sd_const. Name, e-mail, plug-in name, Plug-in Description, category, country, language, and Comment are all up to you. I leave Input Encoding at UTF-8 and I'm not going to research it to give a good explanation.

Next, I'm going to fill in the Search URL. This is the hardest part. I can either look at the code of the page I want to make a plug-in for or, in the easiest case, look at the URL of the page doing a search. The South Dakota Constitution search is easy because it passes its search string in the URL. To get to § 6, the Bill of Rights, the page uses the URL http://legis.state.sd.us/statutes/DisplayStatute.aspx?Type=Statute&Statute=0N-6. The important part is seeing where the "6" is. Copy everything up to the "6" paste it into the Search URL text box and put "{searchTerms}" where the 6 was. Thats it. For searches that don't pass on the URL, I'll figure it out and fill you in later.

Now make sure the Get radio button is checked. For the other fields; suggestions URL is for sites that support this and those probably have made their own plug-in and I don't know what the Search Form URL is for yet but I had to fill it in. I used http://legis.state.sd.us/statutes/Constitution.aspx.

Finally, hit the Generate Plugin button and then Install Plugin button. Test the plug-in out and if it works, hit the Submit Plugin button. Thats it.

3 comments:

  1. IMO, there's a better way.

    Find whatever search box you want to use and, using firefox right click the text area. Select "Add a Keyword for this Search". Insert your shorthand keyword (wiki, sdcl, goog, etc...).

    Now you simply lead your search term with the keyword you've provided. ex. "sdcl xx-xx-xxx"

    ReplyDelete
  2. I'm pretty sure you stole my thunder.

    ReplyDelete
  3. Not really... my way won't put it in the search bar the same way yours does... My way is only functional from the awesome bar as far as I know.

    ReplyDelete