Ohlone College home page.

TUTORIAL CONTENTS:

Home Using Email Connect and Browse Search Tools Boolean Searching Accessing Web Databases Evaluating Sources Copyright and Citation
INTERNET TUTORIAL from the Ohlone Library

ADVANCED SEARCHING: BOOLEAN LOGIC

What Is Boolean Searching?

With Boolean searching you use "Boolean logic" or "Boolean operators" to combine keywords and so control the resulting matches. (It's called Boolean after George Boole, an Irish mathematician who came up with this logic in the 19th century). The Boolean operators - the common words AND, OR and NOT - let you conceptually narrow and broaden the results of your searches by specifying exactly what you want your search results to contain.

When Do You Use It?

Boolean logic is not just used on the Internet - if you understand the principles of Boolean searching you will be able to use it in many other electronic searching situations: on library catalogs, CD-Rom databases, as well as databases on the WWW.

When a search tool on the Internet supports Boolean logic, you can use Boolean operators in your searches to improve the search results you get. Not every search tool supports Boolean logic - check the help screens at any given tool to see if it does. Altavista.com and northernlight.com, for example, both do support Boolean operators.

The Operators:

The Boolean operators are described below, with examples. Note: in some search tools the Boolean operators have to be typed as capitals, in others it doesn't matter. They are capitalized below for readability, but check the help screens at any given tool to see if you need to use caps.

The Boolean AND Operator

When to Use:

Use this operator to conceptually narrow your search results by requiring that documents retrieved include all your keywords.

Example:

If you type:

          workplace AND privacy

The search tool will retrieve documents that contain both of those words.

Visual Aid:

Image showing two connected circles representing the search: workplace and privacy.  The overlapping area is the search result.

Text to Aid in the Understanding of the Visual Aid:

If the circle on the left represents all the documents matching on the keyword "workplace" and the circle on the right represents all the documents matching on the keyword "privacy" - the red area where the circles overlap represents all the documents containing both keywords. This set is smaller than the workplace circle, smaller than the privacy circle, and certainly smaller
than the combination of the two. This smaller, conceptually focused set of documents is what you would retrieve by combining
the two terms with the AND operator.

The Boolean OR Operator

When to Use:

Use this operator to conceptually broaden your search results by allowing documents retrieved to include any of your keywords. This technique is useful with synonyms, such as "jacket or coat."

Example:

If you type:

         workplace OR privacy

The search tool will retrieve documents that contain either of those words.

Visual Aid:

Image showing two connected circles representing the search: workplace or privacy.  The entire two circles and their overlap is the search result.

Text to Aid in the Understanding of the Visual Aid:

The circle on the left still represents all the documents matching on the keyword "workplace" and the circle on the right still represents all the documents matching on the keyword "privacy" - this time the red area includes all of both circles, representing all the documents containing either keyword (including those documents that happen to contain both). This set is larger than the workplace circle, larger than the privacy circle, and certainly larger than the overlap of the two. This larger, conceptually broadened set of documents is what you would retrieve by combining the two terms with the OR operator.

The Boolean NOT Operator

When to Use:

Use this operator to conceptually narrow your search results by excluding retrieval of documents that include a particular keyword. This technique is useful when you suspect there will be false hits resulting from varying meanings of your keywords (like if you want to find documents about REM the rock band, but not about the REM dream state: REM NOT dream), or when you want to exclude a particular aspect of your topic (like fish NOT saltwater). Note that on some systems, the correct syntax is:     workplace AND NOT privacy

Example:

If you type:

       workplace NOT privacy

The search tool will retrieve documents that contain workplace, as long as the word privacy is not present in them.

Visual Aid:

Image showing two connected circles representing the search: workplace not privacy.  The workplace circle minus the overlap is the search result.

Text to Aid in the Understanding of the Visual Aid:

The circle on the left still represents all the documents matching on the keyword "workplace" and the circle on the right still represents all the documents matching on the keyword "privacy" - this time the red area includes only the workplace circle, except that part of it which overlaps with the privacy circle. The resulting set represents all the documents containing the keyword workplace, unless the keyword privacy is also included. This conceptually narrowed set is what you would retrieve by combining the two terms with the NOT operator.

Getting Fancy: Parenthetical Boolean Statements

Sometimes you need to use multiple keywords, and organize them in different complex combinations, where some words are synonyms, some words should be excluded, some words required, etc. In these cases, the order in which your operators are executed makes a difference in the results you will get. How do you tell the computer what order to execute your operators in? Use parentheses to "nest" the pieces of your Boolean search.

Examples:

          (workplace or job) and privacy

In English, this would be expressed as: give me all the documents with either workplace or job, and also with privacy.

Using the parentheses tells the computer to do the "or" part first, then the "and" part, with these results:

Image showing three connected circles representing the search: (workplace or job) and privacy.  The search result area is quite small.

Compare that result to what would happen if the computer happened to execute the AND part first, as in:

          workplace or (job and privacy)

In English: find all the documents with both job and privacy, and  then give me any document with either that combination or the keyword workplace all by itself.

Using the parentheses tells the computer to do the "and" part first, then the "or" part, with these results:

Image showing three connected circles representing the search: workplace or (job and privacy).  The search result area is much bigger than in the previous image.

These are just a couple of examples of the kinds of searches you can do with boolean operators: more complex still would be
"nesting" parenthetical statements within each other. Experiment with these techniques at search tools that support them; but remember  the AND as probably the most useful tool in your Boolean toolbox.

Practice: Go to AltaVista's advanced search interface and search for the following:
"community colleges" AND "computer literacy"
Make sure you are using the boolean search option.
Note how many results you get. Now do this search:
"community colleges" OR "computer literacy"
Note how changing the Boolean operator affects the total number of results.



Previous  |  Page top  |  Next

Please contact librarians@ohlone.edu with your questions, comments, and suggestions. Last updated 11/19/04. Terms and Conditions of Use & Disclaimer. Copyright © 2004 Ohlone College. All rights reserved.