Boolean Operators

Boolean Operators

George Boole, an English mathematician in the 19th century, developed “Boolean Logic” in order to combine certain concepts and exclude certain concepts when searching databases.

Boolean Operator searches allow you to combine words and phrases using the following words which are called Boolean Operators.

  • Near

  • Or

  • And

  • Not

Boolean operators have the power to limit, widen, or further refine your search.  Boolean operators are not case sensitive, and you do not enclose them in quotation marks or parenthesis marks.  (In fact, enclosing a Boolean operator within quotation marks is the way to tell the search engine to treat the operator as a regular word.)

NEAR

The first Boolean Operator, near, is invoked simply by typing in the word near between two words, or two phrases defined by parenthesis. For instance, holiday near pay.  The search engine interprets this search expression as, find the word holiday within ten words of the word pay. (Remember from the earlier example, the search expression “holiday” “pay” tells Microsearch to find those two words exactly one space from each other, in the exact order as entered into the search form.

You can redefine the limits of the Boolean operator near by telling the search engine to widen the span (measured in the number of words) between the two search words: this new limit is set by inserting the new limit adjacent to the word near in parentheses.  For instance, “holiday” near (50) “pay”.  The search would return all documents containing the word “holiday” within 50 words of the word “pay”.

OR

OR is used when you want to find documents containing either search term.  For instance, holiday or pay.  You would not put quotation marks around the word or (unless you wanted Microsearch to interpret this particular instance of the word or as the word, and not as the Boolean Operator.)  The search for holiday or pay would return a list of documents that contained either the word holiday, or the word pay, or both.

AND

And is used in a search expression when you want to find all documents containing both words.  For instance, holiday and pay. You can also put as many words together, with and between each word, to further specify which documents you want to find.  For instance, holiday and pay and overtime and Christmas. Each found document will contain all four search words in any order (Upper or Lower case – the search engine is not case sensitive).

NOT

Not is used to exclude any documents which contains a certain word. For instance, the search expression holiday not pay would find all document containing the word holiday, but eliminate from the list any documents that also contained the word pay.

Nesting

Nesting words and phrases inside parentheses marks is helpful whenever you have a complex search that has more than one logical interpretation, or contains more than one Boolean Operator.  The use of parentheses tells the search engine to do the instruction inside the parentheses marks first, then do the remaining parts of the search expression.

Here is an example of why we need to use parentheses parks.  Suppose you typed in the search expression holiday and pay or Christmas and overtime.  Without parentheses in place, Microsearch might look at the search as if there were parentheses as follows: holiday and (pay or Christmas) and overtime. Logically, this instruction is to find all documents with holiday and overtime and either pay or Christmas.

If you instead put in the parentheses to force Microsearch to understand what you meant to say, you might put them into the expression as follows: (holiday and pay) or (Christmas and overtime).  In this search expression, holiday and pay must be in the same document, and Christmas and overtime must be in the same document.  Logically, this search expression would find only documents containing either sets of words.

Removing Boolean Operator status of near, or, and, not

Sometimes you want to search for a word or phrase that includes a word that is a Boolean expression, but you don’t want the word used that way.

The convention that the search engine uses to remove the Boolean usage is to put the Boolean operator within quotation marks.

For instance, in the search expression holiday or weekend, the search engine  will return all documents that contain either the word holiday, or the word weekend.  But if you really want to retrieve documents containing the precise phrase holiday or weekend, you would remove the Boolean interpretation of the word or by placing it in quotation marks, and instead put in the search expression holiday “or” weekend. The search expression holiday “or” weekend would return all documents containing the precise phrase “holiday or weekend”.

As another example, suppose you wanted to find all documents that contain the phrase, to be or not to be.  This phrase contains two Boolean operators, or and not. Logically, the search engine will first find all the documents that contain the two words “to be”.  And because the second instance of the phrase to be is preceded by the Boolean operator not, the search engine would then find all the documents that do not contain the phrase to be.  In short, the search engine would return every document in the database.

If you really wanted to find the document with the exact phrase, the correct search expression is: to be “or” “not” to be. In this case, both Boolean operators have been cancelled by the quotation marks.

Complex Search

A Complex search can be as straightforward as a two-word phrase plus one Boolean operator – dog or cat – or extremely complex with multiple Boolean Operators, nested or not.