firefox quick searches

rjbs on 2005-01-13T15:10:43

At the LUG meeting on Tuesday, I saw that Brian R. was using the Google bar in Firefox. It's 2005 and people are still using the Google bar! The guy giving the presentation had the default Google widget still on his address bar. Why is that damn thing still there?

Because people don't know about quick searches and keywords. I've mentioned them before, but only in the context of importing to them from OmniWeb. Here's an explanation for Brian and everyone else who's wasting time with trivial search plugins to Firefox.

Go visit Google and search for something. I'm going to search for "rjbs" because I'm egotistical. Google generates this URI for the search:

http://www.google.com/search?ie=utf8&oe=utf8&q=rjbs

It says "search for the query 'rjbs' with the input and output encoded in UTF-8." (I have notes on all of the parameters, but more on that another day.)

I'll be really egotistical, now, and bookmark that search. I'll hit Ctrl-D (I could just go to the Bookmark menu and take "Bookmark this page" but I don't like clicking) and then click OK to save the bookmark.

Now, when I'm curious about what's going on with my name, I can go click that bookmark. Of course, that's sort of silly, so I can take that bookmark and make it more useful. In the Bookmarks Manager (in the Bookmark menu) I can find that bookmark and bring up its properties. Here, I see more fields than there were before, including one called "keyword." If I give a bookmark a keyword, I can use that word to open it.

So, if I wanted to make this bookmark sillier, I could give it the keyword "rjbs" and then just type "rjbs" into the address bar. It would open this bookmark.

I'm going for /less silly/, though, so I'm going to make this sort of an abstract bookmark. In the Location field, I'll replace "rjbs" with "%s" so the Location looks like this:

http://www.google.com/search?ie=utf8&oe=utf8&q=%s

I'll give the bookmark the keyword "g". If I type "g" into the address bar, now, it searches for "%s" -- a pretty useless search. The magic is that I can type more /after/ the "g" in the address. So, to search for myself, I go to the address bar and type "g rjbs". Firefox replaces the magic "%s" in the Location field of the bookmark with everything after the space after "g" and that turns it into a search for rjbs.

I can type "g hot pants" or "g mini site:apple.com" and get those searches.

So far, this saves you no keystrokes. Now you're hitting Ctrl-L, g, space to Google instead of Ctrl-L, tab to get to the Google box. The great thing is that this is obviously not a Google-only approach. I don't need some goofy drop-down with my search engines, either. I just need more bookmarks. Here are some that I like:

	keyword: imdbt
	address: http://www.imdb.com/find?tt=on;q=%s
	purpose: "imdbt Stripes" finds IMDB data on the Murray/Ramis classic

keyword: dist address: http://search.cpan.org/dist/%s purpose: "dist Rubric" finds the information on my Rubric package

keyword: nf Hackers address: http://www.netflix.com/Search?search_submit.x=0&search_submit.y=0&v1=%s purpose: lets me find and enqueue a movie with Angelina Jolie's boobs


I keep all my search bookmarks on my site for future reference; they might be helpful examples:

http://rjbs.manxome.org/links/search.html

These are generated from my ow5sh script, using my OmniWeb shortcuts, which are like Firefox's quick searches. That script is also around:

http://rjbs.manxome.org/hacks/perl/#ow5sh

Basically, if you search someplace often, or use a well-defined URI structure often, you can turn your typing into one of these quick searches and save yourself a lot of time. Google barring is so 2001.


Other stuff

jplindstrom on 2005-01-13T16:00:56

I also use the imdb trick, that's very convenient.

But the Google bar also has other buttons like "Up one level". That sounds trivial, but it's somewhat useful when you have the hand on the mouse and don't want to fiddle with selecting the url text, deleting the correct part, etc.

Also, more importantly, I have configured the Google bar to search-this-site (with the current site) when I press Ctrl-Return. Is that possible with the bookmark approach?

Re:Other stuff

rjbs on 2005-01-13T16:08:45

Up one level and search-this-site should be simple-ish with JavaScript. Make the bookmark a redirect to Google that, to build the redirect, takes the current location, yanks the site, and puts it after site:

Not nothing, but not complex. I'm on a 12" PowerBook, so I don't like giving up space for the googlebar and its minions.

Lazier

Smylers on 2005-01-13T16:51:14

You aren't being lazy enough, with that manual URL hacking!

Simply go to Google (or wherever), right-click on the textbox (or press Shift+F10) and choose 'Add a Keyword for This Search ...'.

Note that it even takes into account the current state of other controls that are part of the form, such as the radio buttons on per-country Google pages.

Smylers

Re:Lazier

rjbs on 2005-01-13T17:36:19

That, sir, is rocking. I will amend my canonical copy of that document asap.

Search box...

Purdy on 2005-01-13T18:29:52

I don't have the Google bar, but I do use search box that has Google defined as the default. That way, it's only a Ctrl-K keystroke away and it keeps a history of what I've searched.

I do use the keyword search for cpan and m-w.com, though ... only b/c I'm not sure if there's a keystroke to switch engines in the search box.

Definitions:
M-W Dictionary:
Location: http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=%s
Keyword: dict

CPAN Search:
Location: http://cpan.uwinnipeg.ca/search?query=%s&mode=dist
Keyword: cpan

- Jason

quick searches wiki

cldwalker on 2005-01-17T09:27:33

Hey rjbs, You probably want to check out http://www.wormus.com/leakytap/Internet/CustomKeywords . It's a page dedicated to firefox quick searches. Html seems to be broken now but you can still rip the links. Someday I'll put my own up. I got a list about the same size.