Google Basics

Generally speaking, there are two types of search engines on the Internet. The first is called the searchable subject index. This kind of search engine searches only the titles and descriptions of sites, and doesn’t search individual pages. Yahoo! is a searchable subject index. Then there’s the full-text search engine, which uses computerized “spiders” to index millions, sometimes billions, of pages. These pages can be searched by title or content, allowing for much narrower searches than searchable subject index. Google is a full-text search engine.

Whenever you search for more than one keyword at a time, a search engine has a default method of how to handle that keyword. Will the engine search for both keywords or for either keyword? The answer is called a Boolean default; search engines can default to Boolean AND (it’ll search for both keywords) or Boolean OR (it’ll search for either keyword). Of course, even if a search engine defaults to searching for both keywords (AND) you can usually give it a special command to instruct it to search for either keyword (OR). But the engine has to know what to do if you don’t give it instructions.

Basic Boolean

Google’s Boolean default is AND; that means if you enter query words without modifiers, Google will search for all of them. If you search for:

snowblower Honda "Green Bay"

Google will search for all the words. If you want to specify that either word is acceptable, you put an OR between each item:

snowblower OR snowmobile OR "Green Bay"

If you want to definitely have one term and have one of two or more other terms, you group them with parentheses, like this:

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")

If you want to specify that a query item must not appear in your results, use 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.”

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, a.k.a. the top first result in the list. Entering washington post and clicking the I’m Feeling Lucky button will take you directly to Trying president will land you at

Just in Case

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 not case sensitive. If you search for Three, three, or THREE, you’re going to get the same results.

Other Considerations

There are a couple of other considerations you need to keep in mind when using Google. First, Google does not accept more than 10 query words, special syntax included. If you try to use more than ten, they’ll be summarily ignored. There are, however, workarounds [Hack #5].

Second, Google does not support “stemming,” the ability to use an asterisk (or other wildcard) in the place of letters in a query term. For example, moon* in a search engine that supported stemming would find “moonlight,” “moonshot,” “moonshadow,” etc. Google does, however, support an asterisk as a full word wildcard [Hack #13]. Searching for "three * mice" in Google would find “three blind mice,” “three blue mice,” “three red mice,” and so forth.

On the whole, basic search syntax along with forethought in keyword choice will get you pretty far. Add to that Google’s rich special syntaxes, described in the next section, and you’ve one powerful query language at your disposal.

Get Google Hacks now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.