Electronic Searching Techniques
Nesting (Boolean Logic)


If you combine different Boolean operators in a single search statement, you must use nesting for the search logic to work properly. If you are doing a search using only AND operators or only OR operators, you don't need to use nesting.

Here is a search statement using two different Boolean operators:

smoking AND adolescents OR teenagers

This search uses the Boolean operators correctly. The synonyms "adolescents" and "teenagers" are combined with OR, and the other concept "smoking" is combined with AND. The problem is with the search logic, the order in which the terms will be combined.

As it is written, this search will create a set of all records that contain both of the terms "smoking" and "adolescents." Then it will create a set of all records that contain the term "teenagers," whether those records have the term "smoking" in them or not. Finally, it will combine the two sets, and the results will include records on "smoking and adolescents" or on "teenagers."

To correct the logic, the search needs to be written this way:

smoking AND (adolescents OR teenagers)

Now the search will create a set of all records that contain the term "smoking" and a set that contains either of the terms "adolescents" or "teenagers." Finally, it will combine the two sets so that the results include records that have the term "smoking" and either "adolescents" or "teenagers." The nested terms, in parentheses, will be processed together.

Here is an example of a search statement using more complex nesting:

(smoking OR tobacco OR nicotine) AND (adolescents OR teenagers)

The OR operations inside both sets of parentheses will be performed first, and then the resulting sets will be combined using the AND operator. Nesting synonyms in this way can broaden your search.

Here is another example of a search statement in which the logic is not properly stated:

smoking OR tobacco AND adolescents OR teenagers

This search will retrieve records on smoking, records on tobacco and adolescents, and records on teenagers. The logic can be corrected by nesting the two OR statements:

(smoking OR tobacco) AND (adolescents OR teenagers)

Try it!

Here are some search statements. Is their logic correct? If not, how would you rewrite the search so that it would work properly? Check your answers by clicking on the letter to the left of the statement.

A. (mule deer OR odocoileus hemionus) AND population density

B. (modernism AND gertrude stein)

C. lesbianism OR bisexuality AND (homophobia OR hate crimes OR violence)

D. metaphor OR (visual imagery) OR simile AND (gerard manley hopkins)

 


Send comments and suggestions about this page to: Martha Johansen
Last Updated: January 20, 2005