Blog
How Boolean search operators make searching a piece of cake

How Boolean search operators make searching a piece of cake

To get the most from your queries, and ensure you’re not missing search results, boost them with my favorite Boolean search operators. Yes. I do have favorites. And after this, you will too.

Try out your search Booleans in Quick Search

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.

“Quotes”

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.

Chocolate? Yes. Cake? Yes. Chocolate Cake? Hell no!

To limit my search for an exact phrase, I need to add quotation marks, like so -

Quotes Query Boolean

Now, I will only get relevant results that mention chocolate cake.

AND

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 -

AND query Boolean

Now, I should find the references I want

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 fudge, then I can.

NOT

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 -

NOT query Boolean

Now I know my results only include references to cream and not ice cream.

Near

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 -

NEAR query Boolean

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.

Chocolate cake layered with sour cream and Nutella frosting and Nutella ganache 🎥 By @historiasdelciervo ••••••••••••••••••••••••••••• ❤️️Follow @thafoodheaven 💥Follow @thafoodheaven ••••••••••••••••••••••••••••• 🧀 Double Tap If You Like This 🍕 Turn On Post Notifications ••••••••••••••••••••••••••••• Tag us in your favorit dishes for a chance to be featured on thafoodheaven #thafoodheavenz ••••••••••••••••••••••••••••• 📷 All rights and credits reserved to the respective owner(s)

A post shared by 🌩The god of all things tasty 🌩 (@thafoodheaven) on

OR

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 -

OR query Boolean

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.

Asterisk*

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 -

Asterick query Boolean

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 -

Brackets Query Boolean

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 -

The 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).

Quick Search CTA