Sunday, February 03, 2008

How to add Search engine to FF

I wanted to do Google searches for a keyword + list of sites. Simple? Not really, so I will save myself the trouble of all the typing of something like:
When all you want is NE555. Adding a new engine to the FF bar is simple, or you could spend 30 minutes to try finding a plug-in that does not do what you want.

Not scared of editing a bit of XML? Read on.

Find your firefox install folder, the default is C:\Program Files\Mozilla Firefox\searchplugins - you want the searchplugins sub-folder. Next make a copy of your fave engine file, I copied my google.xml file, and called the new one data.xml.
Open in a text-editor, and find the line:
Give your 'engine' a name, (keep it short-ish) next go to the line:
<Description>Google Search</Description>
You can add a description, which I think gets used only in the properties to manage (add/remove) your engine. Next find the line:
<param name="q" value="{searchTerms}">
This is where the magic starts, and depends on which engine you copied, since other engines will not have a 'q' parameter for instance.

If you are lost now, use your engine to do a proper search, and then inspect the resulting location or URL to see which is the parameter is you actually want to modify.
To search only for datasheets I used this line
<Param name="q" value="DATASHEET {searchTerms}"/>
You could add a site or list of sites by adding the strings to your query.
The search-parameter tag might look a little strange to some of us who are new to XML, but you will notice the / slash in the closing, this is a space-saver telling an XML parser, that there is no 'closing' of this tag. If restarting FF does not give you a new engine, try double-click on your new file to open it in your browser, which should reveal what you broke.

Viola! (Fluit-fluit, my storie is uit.)

No comments: