Boolean Logic

Developed by English mathematician George Boole in 1854, Boolean algebra was designed as a symbolic system of mathematical logic to represent relationships between entities. Later known as Boolean Logic, it has become the basic design of digital computer circuits and the basis of many Internet search engines. 

Boolean operators are: OR, AND, and NOT. Using Boolean operators in database searching can improve search results, but computers depend on human input and will produce results only as good as the search query entered.

OR

Using OR will broaden a search or increase results:
A OR B
Stamp OR Stone
disability OR disabilities
"contact sport" OR "noncontact sport"

AND

Using AND will narrow a search or decrease results: 
A AND B
Albright AND grievance
"bail reform act" AND 1984
"previously limited" AND male

NOT

Using NOT will exclude terms and decrease results:
A NOT B
"Southern District" NOT Maynard
"equal opportunity" NOT "equal protection"

Combining Boolean Operators

Usually more than one Boolean operator is used in a query. When Boolean operators are combined, search queries become more complex and the search results may become unwieldy if the following factors are not considered.

Boolean operators are processed in the following order: NOT, AND, and OR.

EXAMPLE: You have just been asked by a senior partner to find all federal and state case law involving surveillance videos in either workers compensation or insurance fraud cases. The partner is already aware of the two West Virginia Supreme Court cases on point.

Armed with this knowledge, you choose a federal and state case law database and enter:

surveillance AND video AND workers compensation OR insurance fraud NOT west virginia

1.  The search engine will read from left to right, looking for the Boolean operator NOT. If the search query includes NOT, the search term to the right of the operator will be excluded.
  • Our results will exclude any cases that mention the term "west" - not just West Virginia Supreme Court cases, but any case that includes the word "west" anywhere in the decision.
  • The term "virginia" is ignored.

2.  The search engine will read from left to right, looking for the Boolean operator AND. If the search query includes AND, the search term to the right and left of the operator will be combined. These results will be added to the results of the NOT query.

  • Our search results will include cases that contain both of the terms "surveillance" and "video".
  • The results will also include cases that contain both of the terms "video" and "workers".
  • All of these cases will be added to the first set of cases that contain the term "west".

3.  The search engine will read from left to right for the Boolean operator OR. If the search query includes OR, it will retrieve any items with either term to the left or the right of the operator. These results will be added to the results of the previous set.

  • Our search results will include any cases that contain either of the terms "compensation" or "insurance". The term "fraud" will be ignored.
  • These cases will be combined with the results of the previous two sets of results producing our total number of cases.

Quotation Marks

To solve the problem of words being ignored as our above example illustrates, surround phrases with quotations marks:

"workers compensation" OR "insurance fraud" NOT "west virginia"

1. The search engine will read from left to right, looking for the Boolean operator NOT. If the search query includes NOT, the search term to the right of the operator will be excluded.

  • Our results will exclude any cases that mention the term "west virginia".
  • The term "virginia" is no longer ignored because it is included in the phrase "west virginia".
  • The search will proceed as described in the example above.

Nested Logic

To solve the problem of multiple operators in one search statement, parenthetical or nested logic was developed. Nested logic uses parentheses ( ) around search terms to help refine the search.

MOST IMPORTANTLY, NESTED LOGIC TAKES PRECEDENCE OVER BOOLEAN LOGIC.

(surveillance AND video) AND ("workers compensation" OR "insurance fraud")

Therefore, in the search example above, an opening parenthesis in front of the term "surveillance" and closing parentheses after the term "video" solves the problem of combining the terms "video" and "workers". Refining this search with nested logic will produce better results.

1. The search engine will read from left to right, looking for Nested Logic. If the search query includes nested logic, the search terms inside the parenthesis will be processed first.

  • If the query contains more than one set of nested logic, the search engine will process the sets of nested logic from left to right.
  • Our search results will include cases that contain both of the terms "surveillance" and "video".
  • Proceeding from left to right, our search results will also include cases that contain "workers compensation" OR "insurance fraud".
  • Cases that contain "workers compensation" OR "insurance fraud" will be added to the results of the first set.

Boolean Logic Quiz

Test your knowledge by taking the Quiz -- Boolean Logic. Your answers will be sent via e-mail to Kevin Fredette for grading.


West Virginia University College of Law Library  Yellow Bullet  P.O. Box 6135 Yellow Bullet Morgantown, WV 26506-6135  Yellow Bullet Contact Us  Yellow Bullet Last Modified:

 

WVU Home A-Z Site Index WVU Campus Map Law Library