Previous Section  < Day Day Up >  Next Section

1.12. Understanding Google URLs

If you're like most people, you usually pay little attention to the URLs in your browser's address bar as you surf from one site to the next. And you might choose to stick with this habit while searching Google. You ought to know, however, that a subtle alteration made to the URL that Google returns after a search can be an efficient method of tweaking your result set. In fact, there's at least one thing you can do by fiddling with (we like to call it hacking) the URL that you can do no other way, and there are quick tricks that might save you a trip back to the Advanced Search page.

Say you want to search for three blind mice. The URL of the page of results will vary depending on the preferences you've set, but it will look something like this:

http://www.google.com/search?num=100&hl=en&q=%22three+blind+mice%22

The query itself—q=%22three+blind+mice%22, %22 being a URL-encoded " (double quote)—is pretty obvious, but let's break down what those extra bits mean.

The num=100 refers to the number of search results to a page: 100 in this case. Google accepts any number from 1 to 100. Altering the value of num is a nice shortcut to altering the preferred size of your result set without having to meander over to the Advanced Search page and rerun your search.

Don't see the num= in your URL? Simply append it by clicking at the end of the URL in your browser's address bar and typing it in. To set the number of results per page to 20, for instance, you'd add &num=20.

You can add or alter any of the modifiers described here by appending them to the URL or changing their values—the part after the = (equals)—to something within the accepted range for the modifier in question. If you're adding a modifier, you'll need to use an & symbol (ampersand) too. Look at how the modifiers are joined together on URLs for other search results to see how it's done.


The hl=en means the language interface—the language in which you use Google, reflected in the home page, messages, and buttons—is in English. Google's Language Tools ["Language Tools" earlier in this chapter] page provides a list of language choices. Run your mouse over each language choice and notice the change reflected in the URL; the URL for Pig Latin looks like this:

http://www.google.com/intl/xx-piglatin/

The language code is the bit between intl/ and the last /xx-piglatin, in this case. Apply that to the search URL at hand by altering the existing value of hl:

hl=xx-piglatin

What if you put multiple hl modifiers on a result URL? Google honors whichever one comes last, reading from left to right. While it makes for confusing URLs, this means that you can always resort to laziness and add an extra modifier at the end rather than editing what's already there, like so:

http://www.google.com/search?num=100&hl=en&q=%22three+blind+mice%22&hl=xx-piglatin

There's one more modifier that, appended to your URL, may provide some useful modifications of your results:


safe=off

Means the SafeSearch filter is off. The SafeSearch filter removes search results of a sexually explicit nature. safe=on means the SafeSearch filter is on.

Playing about with Google's URL may not seem like the most intuitive way to get results quickly, but it's much faster than reloading the Advanced Search form, and in one case (the "months old" modifier), it's the only way to get at a particular set of results.

    Previous Section  < Day Day Up >  Next Section