How Boolean search operators make searching a piece of cake

How Boolean search operators make searching a piece of cake header

Contents

When it comes to social listening, or any type of media monitoring, getting the right data is key. Boolean searches help you narrow down your search to only find the mentions you need.

They may seem complicated at first. But once you realize the full potential of them, you’ll soon become a Boolean lover. And be able to create perfect social media monitoring queries in no time.

If Booleans aren’t for you, there’s an alternative solution for writing the perfect social listening query.

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. Found within social listening tools or social media monitoring tools, they improve result accuracy.

You can just search for the keyword you’re looking for. But these Booleans will make finding results quicker, cleaner, and extra chocolatey. For valuable insights in real-time, as easy as pie.

“Quotes”

Let’s start with quotes. Sometimes, a search query isn’t a single word, but a specific phrase.

Say you want to search for chocolate cake. If you put chocolate cake into your 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? NO!

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

Quotes Query Boolean - search operators

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

AND

Great. But what if you want chocolate cake with cream. You can do a specific search for the phrase “chocolate cake with cream”, but that query will only find mentions of that exact phrase. You’d miss mentions like, chocolate cake with whipped cream, chocolate cake served with cream, cream-covered chocolate cake, etc.

What you need is AND. Like this -

AND query Boolean

Now, you should find the references you want.

You can have as many ANDs as you need. So if you want to find a recipe that includes chocolate cake AND cream AND cherries AND mousse, then you can.

NOT

But you need help with your results. By searching for cream in the above query, you found mentions of ice cream too. And although most people enjoy a scoop of frozen goodness, you don’t want it here.

That’s where NOT comes in. It excludes mentions of specific keywords-

NOT query Boolean search operator

Now you know your results only include references to cream and not ice cream.

NEAR

Another issue you had was that mentions of cream were also coming up as an action. As in, to cream butter. And you want it as a topping.

To narrow this down, you can use the NEAR Boolean search operator. Known as a proximity operator. This searches for mentions of one term near another, like this -

NEAR query Boolean search operator

You can specify 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 you’ll get.

You can also choose between NEAR and ONEAR. NEAR doesn’t depend on order so you will get chocolate cake near cream and cream near chocolate cake. ONEAR focuses on the order of your query. So it will find mentions of chocolate cake near cream, but only when chocolate cake comes first.

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 you’d add OR -

OR query Boolean search operator

Your 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.

Wildcard Search (* or ?)

Can you spot the issue with the query above?

Mississippi is tough to spell. So you need to include misspellings in your search.

There are two ways you could tackle this. You could include all spelling variations in your query, like “Misissippi mud pie” or  “Missisippi mud pie”. But there’s a lot of possible permutations and you could miss some.

Instead, you can add an asterisk (*). Add this wildcard operator at the end of words to find all variations of that word. So including choc* in your query would find mentions of chocolate, chocolates, chocolatey, choccy, chockful, etc.

For my Mississippi mud pie example, you can use this -

Asterick query Boolean search operator

This isn't perfect as the mis* in this query will search for hundreds of potential words that start mis. It shouldn't cause too many problems, as the results will relate to the more unusual mud pie phrase.

The asterisk worked as expected -

 

? has a similar use, but replaces exactly one character. This is especially useful for words spelled in British and American English.

Examples: Apologi?e, Paraly?e, Defen?e

Combine Boolean search operators with brackets ()

Great. Now you have the basics, you can put them all together in one complex search string. But with so many ORs and ANDs and NOTs going on, you need to ensure your search knows what to include or exclude. And that’s why you add some brackets -

Brackets Query Boolean search operator

Very quickly you’ve built a complicated query around these simple Boolean operators. In the above example, you’re searching for -

  • Chocolate cake or fudge cake.
  • Near references to cream (not ice cream).
  • And that also includes mentions of cherries or a cherry.

Which means your Boolean search query should find you a piece of cake with a cherry on top -

 

Other useful Boolean queries

Sentence search

If you are searching for results that contain two or more keywords in the same sentence, use the SENTENCE operator. For example, (Talkwalker) SENTENCE (“customer service”) finds mentions of Talkwalker in the same sentence as customer service.

Special characters

Does your brand name contain special characters (@,#, $, -,+, and &) or punctuation? If yes, you will find Raw Data Search very useful. Raw Data Search +"..." will help you find an exact sequence of characters, including special characters. For Raw Data Search you need to add the + symbol before your keyword and enclose your keyword in quotes.

For example, +"l'oréal" will find results respecting the characters ' and ´.

If you want to track exact matches, including special characters and capitalization, use ++ before your search query. ++"L'Oréal" will return results respecting the characters ' and ´ as well as the capital letters L and O.

Similar keyword search

If you want to search for similar keywords, use tilde followed by the alphabet count (~X) after a keyword. For instance, the search query money~1 will find results with money, honey, etc.

Similar phrase search

If you want to search for phrases that may contain a hyphen, space, or other special character, use the tilde symbol (~). The tilde symbol (~) is for phrases with a maximum of 4 words.

Example: The search query “stay at home"~ will find results for stayathome, stay-athome, stay at home, etc.

Title search

If you want results that only include title mentions of your keyword, use the Title search.

Example: The search query title:LEGO finds results where the article title mentions Lego.

Content search

Like the Title search, the content search finds keyword mentions within the content of an article.

Example: The search query title:LEGO finds mentions of Lego within the content of an article.

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 demo of Talkwalker Social Listening. Click below to see how it can find every brand mention.

 

 

 

Topics

Share it