I originally wrote this post for a software company’s blog in 2014. This company was bought out and recently their blog and website have been removed from the web permanently. I am reposting it here for posterity.
Much of the foundations of computer science where laid in a different era, one long before smartphones, laptops and desktop computers were even a dream. A major part of this foundation was laid in the 1850's by an English mathematician named George Boole. His work on what became known as Boolean Algebra was crucial to developing the digital electronics necessary to modern computers.
Much of this Boolean logic is buried deep inside the electronic recesses of your computer in the electronic circuits that make up the CPU of your machine.
However, there is an area where George Boole's work is much more accessible and just as useful. This is in the search algorithms that you can use in search engines like Google or Bing, to the search functions of your computer operating system, your department's police records management system software, GIS or crime analysis software.
Nearly everyone who has used a computer knows that you can enter a word of phrase into a Google search box to search for web pages with those words. However, most search functions also allow you to use Boolean Operators to fine tune your search. Let's look at the basics of Boolean operators.
The AND operator allows you to search for something that meets both criteria. For example of you search for:
ice AND cream
you will only get results that match "ice cream". You would not get results for "ice milk" or "coffee with cream".
With many search functions the AND operator is the default or implied search. For example, if you went to the search engine Bing, and searched for:
It's the same as typing "ice AND cream". You've probably been conducting AND searches and didn't even know it.
Another type of Boolean operator is the OR operator. This operator allows you to search for either one, or the other. For instance if you type:
coffee OR cup
You'll get results that have either of those words in the result such as "coffee cake" and "measuring cup". OR searches tend to be much broader because the search conditions are easier to meet.
OR searches are not the default for search engines like Google or Bing so consequently you have to type the OR operator in your search terms to conduct an OR search. In the case of Bing, the OR between terms has to be capitalized. It's always a good idea to get in that habit and capitalize all Boolean operators.
The NOT operator excludes a word from your search results. For example if you type:
chocolate NOT cake
then your results could return "chocolate milk" or "chocolate icing" but nothing that includes "cake".
More Google & Bing Tips
Here are a few more tips for getting the most out of Google or Bing searches. Some of these tips also have analogues for other searches within some of your applications. Check the applications' documentation for what they implement and how.
If you're looking for an exact phrase then enclose your search phrase in quotes, such as:
"the quick brown fox"
will only return results that begin with those words in that exact order. For Google searches you can even use a wildcard character, the asterisk ( * ), inside the quotes for a placeholder for unknown words. If you search for:
"the quick brown *"
It will return with results for any phrase that begins with the first three words.
You can also use two periods ( .. ) to search for a range. For example if you search for:
you'll get results that range between 15000 and 25000.
If you want to constrain your Google or Bing search to one particular website or URL preface your search criteria with "site:". In this example if you type:
it would only return results containing the word "burglary" that appeared in the Problem Oriented Policing Center's website ( pop center.org ). This is an especially handy way to narrow the results to a site that you know might be more likely to contain the information you are looking for.
Both Google and Bing have specific conventions for using Boolean operators as well as other neat tricks. More information about search operators for Google and Bing can be found here:
Taking the time to learn how to use these operators when searching can help you find what you are looking for without returning a lot of irrelevant results.