Ramsey Library Research Guides

How do I use Boolean Operators?

The examples on this page illustrate the use of the Boolean operators OR, AND, and NOT in Keyword searches. You cannot use Boolean operators in other types of searches.


Keyword searches look for matches in the title, subject headings, author and note fields of each catalog record. The most important note field is Contents, which may list individual chapters, essays, short stories, or other parts of a book, anthology or recording. 


This FAQ has four parts:

  1. Simple searches with one Boolean operator
  2. Parentheses in searches with more than one Boolean operator
  3. Truncation
  4. Boolean NOT
     

I. Simple searches with one Boolean operator

Imagine that you need to find several books about jazz or blues music for a class assignment. To get an overview of what is available before focusing on some aspect of jazz or blues music, you perform three Keyword searches in the library catalog:

  • jazz OR blues 
         This search finds books that discuss either jazz or blues.
         OR always broadens a search.
     
  • jazz AND blues
         This search finds books that compare jazz and blues.
         AND always narrows a search.
     
  • jazz NOT blues
         This search finds books that are exclusively about jazz.
         NOT always excludes records with the specified term.
     

 

Venn diagrams use circles to visually represent Boolean search results. On this page, each large circle represents a group, or set, of catalog records containing one search term. Each dot represents a single catalog record in our hypothetical search.

Black dots = catalog records that contain the word jazz
White dots = catalog records that contain the word blues
Black/White dots = catalog records that contain both jazz and blues

Keyword search for: Jazz OR blues

This search locates books that may be about either jazz or blues, or that compare both forms of music.

  Count the records (dots) retrieved by this search:
jazz set 21
blues set 20
jazz or blues set
32
Every record in the jazz or blues set contains at least one of the search terms jazz or blues. 9 records that contain both terms appear where the sets overlap.

jazz

blues These search results demonstrate that you should use OR if you want to retrieve either this term or that term. (Of course, you can OR more than two terms together.) OR always broadens a search.

<---- jazz or blues ---->
(The entire turquoise area)


Keyword search for: jazz AND blues

This search locates books that discuss or compare both jazz and blues.

  Count the records (dots) retrieved by this search:
jazz set 21
blues set 20
jazz and blues set
  9
The result of this search is jazz and blues, the intersection of the jazz set and the blues set. Every record must contain both jazz and blues.

jazz

blues Use AND when you want to combine search terms. AND always narrows a search.

jazz and blues
(Where the sets overlap)


A Few Words About ... 
Phrase Searching and Implied "AND"

Be aware of how a particular search engine handles phrases entered as 
search terms.

Some databases, such as the library catalog, automatically search multiple words together as one phrase.

spanish cooking = searches the phrase "spanish cooking"

If your results are unexpectedly skimpy, it may be that your words are being searched as a phrase in a database where that exact word phrase seldom appears. Check the help screens to see if the database searches adjacent search words as phrases. The solution is to redo the search using AND between search terms.

spanish and cooking = searches the words "spanish" AND "cooking" in any order found anywhere in the record.

In some databases, AND is automatically implied between words. If your search results are surprisingly large or irrelevant, implied AND may be breaking your intended phrases into single search terms. In that case, check the help screens for search instructions.

 

Keyword search for: jazz NOT blues

This search excludes records that contain the term blues.

  Count the records (dots) retrieved by this search:
jazz set 21
blues set 20
jazz not blues set
12
The part of the jazz set that does not contain records in the blues set is retrieved as the jazz not blues set.

jazz

          |

blues This last search eliminates all records that contain the term blues. If a book compares jazz with blues, you might lose it from your search. Therefore, use NOT with restraint and be aware of the consequences.

jazz NOT blues
(Turquoise area)

 

When to use NOT and when not to use NOT!

NOT is appropriate in cases where the same word is used in different contexts. For example, the search vikings not minnesota would retrieve records about Vikings but not the Minnesota Vikings. If you are doing a history paper about Medieval Viking sagas, this is probably a good thing. If you are writing about pro football, it's not.


II. Using parentheses in searches with more than one Boolean operator

Sometimes a focused search must combine several related words for one idea with another word or words, as in the search: (logging or clearcutting) and rainforests.

In this search, we used Boolean OR to combine the related words: logging OR clearcutting. Then we used Boolean AND to combine these words with rainforests. The parentheses ensure that results are what we expect.

 

Parentheses indicate relationships between search terms. They force the computer to process your search terms in the order you intend and to combine them in the way you want. Read more about computer search order below.



Computer search order

The library catalog processes your search from left to right, but it processes all the Boolean AND operators BEFORE processing any Boolean OR operators. To change this order, group synonyms (or terms that belong together) with parentheses. Anything enclosed in parentheses is evaluated first. To see how this works, compare the two searches below:

lacrosse or soccer and history Retrieves 50+ items
Combines soccer and history
Retrieves all books about lacrosse
This is not what you wanted!
(lacrosse or soccer) and history Retrieves 25+ items
Combines lacrosse or soccer
"ANDs" those results with history
This is exactly what you wanted!

Of course, you can use more than one OR in a search, as in: (tobacco or smoking) and (cancer or health)


III. Using truncation

If you want to search for part of a word or a whole word that may have several endings, use an asterisk (*) as a "wildcard." It will improve search results and save you time. For example:

To Find: Use:
university or universities
universit*
legislate, legislates, legislator, legislators, legislation, or legislating legislat*


IV. Using Boolean NOT

How should you use Boolean NOT? Very Carefully!

NOT eliminates all records that contain the term preceded by NOT, but it is a useful tool when a search word has several unrelated meanings. You also can use NOT to exclude some commonly discussed aspect of a subject.

For example, if you are doing a term paper on banks or banking in North Carolina, and you keep getting titles about the Outer Banks of North Carolina, you could tighten up your search by using NOT:

(North Carolina and bank*) not outer

If you are researching salamanders but do not want to look at anything about newts, you could do this:

salamanders not newts

However, you should be aware that any book with chapters about both salamanders and newts will be eliminated from your search results. So, NOT is a very risky operator to use in this search!

NOT is expressed differently in some databases (including the Library Catalog)

While NOT is the standard operator for excluding a term in a Boolean search query, some search engines just have to be different.

The Library Catalog recognizes AND NOT to exclude terms, as in:

(jazz and blues) and not funk

Some search engines even use BUT NOT, but this is fairly rare and weird. (If you ever get a but not, apply a warm compress and consult with your doctor.)


Return to top

Back to Library Research Learning Modules

Last updated 20 August 2002.

Ramsey Library
UNCA