Google Web Search Basics

Whenever you search for more than one keyword at a time, a search engine has a default strategy for handling and combining those keywords. Can those words appear individually anywhere in a page, or do they have to be right next to each other? Will the engine search for both keywords or for either keyword?

Phrase Searches

Google defaults to searching for occurrences of your specified keywords anywhere in the page, whether side-by-side or scattered throughout. To return results of pages containing specifically ordered words, enclose them in quotes, turning your keyword search into a phrase search , to use Google’s terminology.

On entering a search for the keywords:

to be or not to be

Google will find matches where the keywords appear anywhere on the page. If you want Google to find you matches where the keywords appear together as a phrase, surround them with quotes, like this:

"to be or not to be"

Google will return matches only where those words appear together (not to mention explicitly including stop words such as “to” and “or”; see the section “Explicit Inclusion” a little later).

Phrase searches are also useful when you want to find a phrase but aren’t quite sure of the exact wording. This is accomplished in combination with wildcards, explained later in the chapter in “Full-Word Wildcards.”

Basic Boolean

Whether an engine searches for all keywords or any of them depends on what is called its Boolean default . Search engines can default to Boolean AND (searching for all keywords) or Boolean OR (searching for any keywords). Of course, even if a search engine defaults to searching for all keywords, you can usually give it a special command to instruct it to search for any keyword. Lacking specific instructions, the engine falls back on its default setting.

Google’s Boolean default is AND, which means that, if you enter query words without modifiers, Google will search for all of your query words. For example, if you search for:

snowblower Honda "Green Bay"

Google will search for all the words. If you prefer to specify that any one word or phrase is acceptable, put an OR between each:

snowblower OR snowmobile OR "Green Bay"

Warning

Make sure you capitalize the OR; a lowercase or won’t work correctly.

If you particularly want one term along with one of two or more other terms, group them with parentheses, like so:

snowblower (snowmobile OR "Green Bay")

This query searches for the word “snowmobile” or phrase “Green Bay” along with the word “snowblower.” A stand-in for OR, borrowed from the computer programming realm, is the | (pipe) character, as in:

snowblower (snowmobile | "Green Bay")

Negation

If you want to specify that a query item must not appear in your results, prepend a - (minus sign or dash):

snowblower snowmobile -"Green Bay"

This will search for pages that contain both the words “snowblower” and “snowmobile,” but not the phrase “Green Bay.”

Note that the - symbol must appear directly before the word or phrase that you don’t want. If there’s space between, as in the following query, it won’t work as expected:

snowblower snowmobile - "Green Bay"

Do be sure, however, that there’s a space before the - symbol.

Explicit Inclusion

On the whole, Google will search for all the keywords and phrases that you specify (with the exception of those you’ve specifically negated with -, of course). However, there are certain words that Google will ignore because they are considered too common to be of any use in the search. These words—“I,” “a,” “the,” and “of,” to name a few—are called stop words .

You can force Google to take a stop word into account by prepending a + (plus) character, as in:

+the king

Stop words that appear inside of phrase searches are not ignored. Searching for:

"the move" glam

will result in a more accurate list of matches than:

the move glam

simply because Google takes the word “the” into account in the first example but ignores it in the second.

Synonyms

Every so often you get the feeling that you’re missing out on some useful results because the keyword or keywords you’ve chosen aren’t the only way to express what you’re looking for.

The Google synonym operator, the ~ (tilde) character, prepended to any number of keywords in your query, asks Google to include not only exact matches, but also what it thinks are synonyms for each of the keywords. Searching for:

~ape

turns up results for monkey, gorilla, chimpanzee, and others (both singular and plural forms) of the ape or related family as if you’d searched for:

monkey gorilla chimpanzee

and some you’d never have thought to include in your query.

Google figures out synonyms algorithmically, so you may well be surprised to find results around words that your garden-variety thesaurus would not have suggested. (Synonyms are bolded along with exact keyword matches on the results page, so they’re easy to spot.)

Number Range

One of the more difficult things to convey in an Internet search query is a range—of dates, currency, size, weight, height, or any two arbitrary values.

The number range operator, .. (two periods), looks for results falling inside your specified numeric range.

Looking for that perfect pair of Prada pumps, size 5 or 6? Try this for size:

prada pumps size 5..6

Perhaps you’re looking to spend $800 to $1,000 on a nice digital SLR camera; Google for:

slr digital camera 3..5 megapixel $800..1000

The one thing to remember is always to provide some clue as to the meaning of the range, e.g., $, size, megapixel, kg, and so forth.

You can also use the number range syntax with just one number, making it the minimum or maximum of your query. Do you want to find some land in Montana that’s at least 500 acres? No problem:

acres Montana land 500..

On the other hand, you may want to make sure that raincoat you buy for your terrier doesn’t cost more than $30. That’s possible too:

raincoat dog ..$30

Tip

Google normally does not recognize special characters like $ in the process of searching. But because the $ sign was necessary for the number feature, you can use it in all sorts of searches. Try the search "yard sale" bargains 10 and then "yard sale" bargains $10. Notice how the second search gives you far fewer results? That’s because Google is matching $10 exactly.

Simple Searching and Feeling Lucky

The I’m Feeling Lucky© button is a thing of beauty. Rather than giving you a list of search results from which to choose, you’re whisked away to what Google believes is the most relevant page given your search (i.e., the first result in the list). Entering washington post and clicking the I’m Feeling Lucky button takes you directly to http://www.washingtonpost.com. Trying president will land you at http://www.whitehouse.gov.

Case Sensitivity

Some search engines are case sensitive; that is, they search for queries based on how the queries are capitalized. A search for "GEORGE WASHINGTON" on such a search engine would not find “George Washington,” “george washington,” or any other case combination.

Google is case insensitive. If you search for Three, three, THREE, even ThrEE, you get the same results.

Get Google Hacks, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.