Published March 8, 2022
How Boolean search operators make searching a piece of cake
What are Boolean search operators?
Booleans are wonderful things that help you optimize searches. If search terms were cake, Booleans are the whipped cream, sprinkles, and glacé cherries that takes that cake up a level.
Yes. I can just search for the keyword I’m looking for. But these Booleans will make finding results quicker, cleaner, and extra chocolatey. And they’re as easy as pie.
Let’s start with quotes. Sometimes, a search query isn’t a single word, but a specific phrase. Say I want to search for chocolate cake. If I put chocolate cake into my search, the engine will find references to chocolate and cake in the same mention. But not specifically, chocolate cake.
since Easter is on April Fools day my mom got brussel sprouts and chocolate covered them to look like cake pops and we took them to our family Easter tonight pic.twitter.com/23dU0KD2MP
— carl (@carlee_whitaker) April 1, 2018
Chocolate? Yes. Cake? Yes. Chocolate Cake? Hell no!
To limit my search for an exact phrase, I need to add quotation marks, like so -
Now, I will only get relevant results that mention chocolate cake.
Great. But what if I want chocolate cake with cream. I can do a specific search for the phrase “chocolate cake with cream”, but that query will only find mentions of that exact phrase. I’d miss mentions like, chocolate cake with whipped cream, chocolate cake served with cream, cream covered chocolate cake, etc.
What I need is AND. Like this -
Now, I should find the references I want
Snacktober Day 8: Dairy
Whipped cream and chocolate curls crown layers of moist chocolate cake, dark Morello cherries and chocolate mousse.
— Yorugami Commissions (FULL) (@ArtofYorugami) October 8, 2019
I can have as many ANDs as I need. So if I want to find a recipe that includes chocolate cake AND cream AND cherries AND mousse, then I can.
But I found a problem with my results. By searching for cream in the above query, I found mentions of ice cream too. And although I usually enjoy a scoop of frozen goodness, I want to narrow my search.
That’s where NOT comes in -
Now I know my results only include references to cream and not ice cream.
Another issue I had was that mentions of cream were also coming up as an action. As in, to cream butter. And I want it as a topping.
To narrow this down, I can use the NEAR Boolean search operator. This searches for mentions of one term near another, like this -
I specified a number (5) to find mentions of chocolate cake within 5 words of the word cream. The smaller the number, the closer the references will be, and the fewer results I’ll get.
I can also choose between NEAR and ONEAR. NEAR doesn’t depend on order, so I will get chocolate cake near cream, and cream near chocolate cake. While ONEAR focuses on the order of my query, so I will detect references of chocolate cake near cream, but only when chocolate cake comes first.
Hungry yet? No? If chocolate cake isn’t your thing, try fudge cake. Or Mississippi mud pie. Or, search for them all.
That’s when I’d add OR -
My results now include references to chocolate cake or fudge cake or Mississippi mud pie. So I can take a look and see what catches my eye.
Can you spot the issue with the query above?
Mississippi is really hard to spell. I know. I got it wrong first time (all hail spell check). So I need to include misspellings in my search.
There are two ways I could tackle this. I could include all spelling variations I can think of in my query, like “Misissippi mud pie” or “Missisippi mud pie”. But there’s a lot of possible permutations and I could miss some.
Instead, I can add an asterisk (*). Add this wildcard operator at the end of words to find all variations of that word. So including choc* in my query would find mentions of chocolate, chocolates, chocolatey, choccy, chockful, etc.
For my Mississippi mud pie example, I use this -
This isn't perfect as the mis* in this query will search for hundreds of potential words that start mis. But it shouldn't cause too many problems, as the results will still be related to the more unusual mud pie phrase.
The asterisk worked as expected -
Combine Boolean search operators with brackets ()
Great. Now I have the basics, I can put them all together in one complex search. But with so many ORs and ANDs and NOTs going on, I need to make sure our search knows what to include or exclude. And that’s why I add some brackets -
Very quickly I built a complicated query around these simple Boolean operators. In the above example, I’m searching for -
- Chocolate cake or fudge cake.
- Near references to cream (not ice cream).
- And that also include mentions of cherries or a cherry.
Which means my Booleans query should find me a piece of cake with a cherry on top -
Image © Mira from Cooking LSL
The Boolean basics
And that’s my basic Booleans. There’s plenty more you can do with the power of searching, but these simple operators will broaden your search results dramatically.
Try them out by requesting a free demo of Quick Search, or leave a comment below with your favorite Boolean operators (or chocolate cake recipes).
Subscribe to our newsletter for social resources
Join 70,000+ professionals and become a better social media marketer. Get social media resources and tips in your inbox weekly.