Quicksearches
What Are Quicksearches?
Also called Smart Keywords, Custom Keywords, Bookmark Keywords, and probably several other things, quicksearches allow you to perform searches from your address bar. For example, with a default installation of Firefox, if you type google election
, Firefox will take you to Google's search results on "election."
Another way to use your quicksearches is to install my Smartsearch search extension, which allows you to select text in the page you're viewing, right‐click, and pick a site to search from the menu.
Creating a Quicksearch
Open up the web page you want to create a quicksearch for. Right‐click the text field where you would enter your query, and select "Add a Keyword for this Search..." Below, I've set up a simple form to search pitt.edu with Google: try it out. The dialog that appears lets you name the quicksearch, choose where you want to create it (probably your Quicksearches folder), and assign a keyword to it. The name and location are mostly to help you keep track of your bookmarks; it's the keyword that counts. In my example above, google
is the keyword assigned to the Google search. You might call this one pitt
.
And you're done! Try typing pitt calendar
in your address bar to search for Pitt's academic calendar.
This method will work for most purposes. If there are multiple fields — like, say, address, city, and state at Mapquest — then fill in all but one of them (presumably everything but address, in this case), and right‐click on the remaining field to add your search. When you perform a search, it is this final field that will be filled with your query.
Manually Creating, Removing, and Modifying Quicksearches
For most people, the ability to right‐click on a text field and create a quicksearch is all you'll ever need. If you happen to want to know more, read on.
Quicksearches are stored as bookmarks. Since you may have a large number of bookmarks, it is a good idea to keep your quicksearches in their own folder; indeed, the default Firefox quicksearches are all located in the Quick Searches folder in your bookmarks. To manipulate quicksearches, click on the Bookmarks menu, and select the Manage Bookmarks option. A new window will appear, and if you click on the Quick Searches folder in the left pane, you will see its contents on the right — namely, the Google Quicksearch and a few others. Right‐click on the Google Quicksearch, and choose Properties to open information about the bookmark. Let's look at the fields. Name is self‐explanatory. Location is seemingly so — the URL of Google? — but isn't quite that simple. It will look something like http://www.google.com/search?q=%s
. The %s
is what makes a quicksearch a quicksearch: When you enter a query (like google election
above), Firefox replaces the %s
with your search terms (in this case, election
). The resultant URL is http://www.google.com/search?q=election
— the address of Google's search results page for "election." The concept is simple but powerful. There's only one other field we need to look at: the keyword. Remember that you typed google election
to perform your search. Firefox knows to use this particular quicksearch because its keyword is set to google
. (Some people find google
unnecessarily long to type, so they change it to g
; with such a change, you would need to type only g election
to perform our example search.)
So you know how to change the quicksearches you have. The Bookmark Manager also allows you to delete quicksearches by clicking on them to select them and then pressing the Delete button in the toolbar. But how do you add your own? Well, it should come as no surprise that you press the New Bookmark button and fill in the information from the last paragraph. However, that is only part of the process; you must also know how to create the search URL. I've provided some of these URL's above, and you can find more on other sites (Mozilla Custom Keywords is one), but there are many other sites that you might like quicksearches for. For an introduction to creating these searches, I recommend Bookmark Keywords at Netscape devedge.
Advanced Quicksearch Creation
Sometimes the method explained at the Bookmark Keywords link above won't work. For example, if you search Wikipedia for "Thomas Jefferson," it will take you to http://en.wikipedia.org/wiki/Thomas_jefferson — a couple characters have changed from what you entered. You can play with Javascript to change spaces to underscores, capitalize the first word, change the other words to lowercase, and perform various other operations, but you are bound to miss some special cases in your painstaking efforts. An even more problematic site is the Gentoo Forums. A search there turns up an indecipherable URL like http://forums.gentoo.org/search.php?mode=results&sid=57a8e6a785fac63024b7bdd10f719c29. This carries no information about the actual query (try clicking on it and seeing if you can tell that I searched for xfce), so no amount of Javascript will magically save us. (The technical difference is that between a GET and a POST, as described at this site on CGI. You need not understand this to follow the explanation below, but I mention this for those who might be interested in an introduction to the topic.)
But there is still hope. I'll explain, using Wikipedia as an example. (A Wikipedia search is built into new installs of Firefox Preview Release 1.0, but not everyone has this; in any case, it's good practice.)
First you'll want to open the page with the search form, of course. Go to the text box you'd enter your search terms into and type something distinctive in it — say, "look at me."
As we've discovered, performing the search doesn't give you a useful URL in this case, so don't do that. Instead, go to Tools | Page Info and click on the Forms tab in the window that appears. It will take a few moments, but eventually you should see "searchform" appear in the table at the top. (The form could be called anything, and there may be multiple entries, so you may need to examine a few forms on some sites.) You may need to resize the window to see the whole table. The column we're interested in is the "Form Action" column; this is the main part of the URL that we'll be using. Copy it (manually, I assume — I don't think there's an easy way) for future use. In the case of Wikipedia, this is:
http://en.wikipedia.org/wiki/Special:Search
Now we need to decide what fields we need to pass to that URL. These fields will be appended to the URL, producing something like this:
http://www.site.com/searchpage.php?field1=somevalue&field2=anothervalue&field3=yetanothervalue
Each field in the URL has some value, and the two are connected by an equals sign. The first field is separated from the main part of the URL by a question mark, and successive fields are delimited by ampersands.
In the same Page Info window and in the same Forms tab, there is a Fields table. If you select "searchform," you should see, notably, Field Name and Current Value columns. Find the row with "look at me" (or whatever phrase you chose) in its Current Value column, and make note of the Field Name. The field is named "search" at Wikipedia. (It comes as no surprise that this is a common name, but there is no requirement that it be the same for other sites.) With "search" as your field name and "%s" as its value (just as with other quicksearches), you will be adding ?search=%s
to the end of the URL.
Now you can put the URL together. The result is:
http://en.wikipedia.org/wiki/Special:Search?search=%s
From the Bookmark Manager you can create a new bookmark and assign it this URL, along with its name and keyword.
Presumably this is more or less how the Mozilla folks created their Wikipedia quicksearch, and I suspect that it's roughly how I made mine, as well. (I guess the search method has changed slightly since then; nonetheless, my version still functions.)
This method is not foolproof, but it works in many cases. If it doesn't work, you may need to include other fields in your URL — something like this, perhaps:
http://www.site.com/searchpage.php?search=%s&resultsPage=true
The best way to determine what these extra fields may be is the same way you used to find the "search" field name in the first place — using the Fields table in the Page Info | Forms tab. If you try adding extra fields and it still doesn't work, you may be out of luck; as I said above, the reason that you needed to do all this Page Info stuff, rather than just look at the URL of the results page, is often that the web site uses a different method to send your search data to the server (POST vs. GET). As far as I can tell, some sites that use POSTS work with this method, while others don't. Good luck.
Advanced Quicksearch Examples
In most cases, the standard method of creating a quicksearch (described at the top of the page) is sufficient, but to give a sense of what more advanced searches can do, I've included a few below.
"Installation"
"Installing" one of the quicksearches below is fairly simple. First, right‐click its link and choose "Bookmark This Link..." You can put it wherever you'd like in your bookmarks. Then you'll need to manually fill in a keyword with the Bookmark Manager, and you're done. Boring description text is also provided, if you're into that sort of thing.
Advanced Quick Searches
- Ant Task Quicksearch
- Type "ant <task>" in the addressbar to view documentation for the Ant task
- Bible Passage Quicksearch
- Type "nab <book chapter[:verse]>" in the addressbar to open the New American Bible to that book, chapter, and optionally verse — Note: James Napolitano suggests visiting Bible Gateway for a simpler Bible quicksearch, one which also supports dozens of Bible versions, ranges of verses (e.g., "John 3:12-16"), and more. See "Creating Quicksearches the Easy Way" below to learn how to create your own quicksearch for that or any other site.
- Google Map Quicksearch
- Type "map <location>" in the addressbar to see the location in Google Maps.
- Jargon File Quicksearch
- Type "jargon <word>" in the addressbar to perform a Jargon File look‐up
- Java API Quicksearch (6.0)
- Type "java <class>" in the addressbar to open the Java 6.0 API docs to that class
- PAT Bus PDF Quicksearch
- Type "bus <route>" in the addressbar to open the schedule and map of the given bus route
- Whois Source Quicksearch
- Type "whois <site>" in the addressbar to perform a whois look‐up