Boolean syntax and operators

This training section covers advanced keyword search, which is also called Boolean search.

What is Boolean search?

Boolean search is a manual type of search that allows users to combine keywords with Boolean operators to produce more relevant results. It looks fancy on the screen but don’t get intimidated - it will take just a couple of trials before you start producing complicated search queries yourself.

When is it better to use Boolean search instead of a simple one?

Boolean search is used when you require stricter search criteria to eliminate generic results that are loosely connected to your brand or other keywords.

Boolean operators

Boolean operators are words that provide a program with some criteria to use when searching the Internet for your query:

Boolean operators Example Explanation
" " "Bank of America" Quotation marks are used when you are searching for a specific word combination or an exact phrase. In Boolean search, use quotation marks whenever your keyword consists of more than a single word.
AND Starbucks AND "latte macchiato" AND means you are searching for documents that contain BOTH keywords (Starbucks, "latte macchiato"). Mentions of Starbucks only or latte macchiato only won’t be shown to you.
OR Starbucks OR Costa OR means you are searching for documents that contain either of keywords (either the word Starbucks or the word Costa or both)
near/n: near/4:James,Shaffer Near/n specifies the closeness of your keywords to each other. This means the program will show you only the documents where keywords appear within n words away from each other. The word order doesn’t matter for this operator. In the example, you’re looking for mentions of James Shaffer but you allow up to 4 words in between the words James and Shaffer. So in your result, you can get mentions such as "James "Munky" Shaffer" and "Shaffer whose name is James". You can type zero and any positive number instead of 4.
onear/n: onear/4:William,Johnson onear/n specifies the closeness of your keywords to each other while taking the word order into account. While James Shaffer has a unique word order (we think), William Johnson definitely does not. To exclude any mentions of Johnson William but still allow all second names and nicknames, activate the operator that emphasizes the word order.
AND NOT Starbucks AND NOT London AND NOT excludes documents that have a particular word/ particular words. In this case, you’re telling the program to include all documents that have the word Starbucks in them AND don’t have the word "London" in them. AND NOT should be used with the operator near/n for better results. If you’ve typed in simply Starbucks AND NOT London, the program will exclude all mentions that have the word London anywhere in the document, for example in the "related articles" section. This way you might miss some relevant results. To make sure you don’t, specify that London shouldn’t be within 50 words from the word Starbucks. This way you exclude mentions of London that are from the same article.
( ) "Marilyn Manson" AND (singer OR rock OR band) Brackets are used to group terms together, so that operators like AND can be applied to all the terms in the brackets.
+" " +"more & more" Exact data search takes into account the special characters and punctuation of your keyword (normally ignored) but ignores lower and upper cases.
++" " ++"L’Oreal" Case sensitive exact data search takes into account special characters, punctuation, and lower and upper cases of your keyword.
FROM Starbucks FROM twitter,youtube FROM specifies the source(s) you want your mentions to come from. If no source is specified, you'll get mentions from all sources. Note that you can shorten the sources in the following way: Twitter = tw. 
UNION Starbucks FROM twitter 
UNION 
Costa FROM youtube
UNION lets you include two different keywords that should come from two different sources in one search. 
lang: lang:en 
lang:en,es
Language search specifies the language of your results. The first example will only launch results in English. The second example will only launch results in English and Spanish. The "lang:" operator can only be used with operators AND and AND NOT (never with OR).
location:  location:"GB,England,Sheffield"
location:US,UNKNOWN
Location search specifies the geographical scope of your search. In this case, you'll only get results from Sheffield, England in the UK. Locations with multiple levels (e.g. Country, city, and state) need to be taken into quotes as in our first example. To include mentions from a specific location (e.g., US) and unknown location, use UNKNOWN as in the second example. Note that if you're only applying the country-level filter, quotes are not required.
link: link:"*.site.com/*"  



link:"site.com/" 



link:"site.com/page" 


link:"site.com/?p=\"123\"" 

 
Search for any document that contains a link to site.com, including all its subdomains, pages, etc. 

Search for any document that contains a link to site.com, excluding the subdomains. 

Search for any document that contains a link to the exact pages site.com/page 

If your link contains quotation marks, include a backslash before each quotation mark that belongs to the link, as in the example.

How to create a Boolean search query?

The white box named Search query is where you are going to type your code. If you’ve typed anything in the simple search before you’ve clicked on Boolean search, you’ll get what you’ve typed in the Boolean format. You can delete everything there and start again manually, or you can edit the search query you already have. Let’s take a couple of examples and go through the process of writing a Boolean search query together. 

Find mentions of an acronym

We want to find all mentions of the brand SEARHC (Southeast Alaska Regional Health Consortium). There are two reasons we want to use Boolean search in this case.

a) It's an abbreviation, which means we'll need a case sensitive search;
b) It looks like a misspelling of the word "search", which is extremely common on the Internet.

How can we make sure the app only finds the abbreviation and not the misspellings? We make the search case sensitive by typing ++"SEARHC":

Make sure the results include special characters

Let's say we want to find all mentions of the brand MORE & MORE. Here, the upper case isn’t actually important. As it is not an abbreviation, people are likely to spell "more & more". The thing we want to specify is "&", as the simple search ignores symbols, and your keyword will be read as "more more” by the program. This will result in a flood of irrelevant mentions.

To avoid this, we use an operator that takes symbols into account and type:

Find mentions where 2 brands are compared

We want to find all documents that compare our brand to the brand of our competitor. We use the operator AND to specify that we need both brands in the same document:

Notice that the brand name SEO Powersuite is taken into quotation marks, as we are looking for a specific word combination. MOZ, on the other hand, is a one-word brand, so it doesn’t require quotation marks. You could also specify the case of the brand, and type in:

With this setup, you are still likely to miss some mentions that come from social media, as users on social media tend to ignore the upper and lower cases. You will still find official reviews, though.

We’ve taken this example to show you how to use the operator AND. However, can you spot a problem with the example?

It’s this: although both brands will be found within the same document, they won’t necessarily be found within the same context. To find mentions of the same context, we should also make sure they are not too far away from each other. We use the operator near/n to do that.

The search string will look like this:

The number 20 means that there can be no more than 20 words in between the keyword SEO Powersuite and the keyword MOZ. You can type in any positive number or zero. Notice that there is no space anywhere in this search string.

Find mentions for an international brand

We have an international brand, let’s say Coca-Cola (hey, this could happen) that has different names in English and in Russian due to the different alphabet.

This means that we have to find all mentions of Coca-Cola (and also Cola) in English, and all mentions of Кока-Кола (and also Кола) in Russian.

The search query will look like this:

Notice that you need to apply the language filter to both Coca-Cola and Cola, so you have to take both words in brackets. The same happens in the Russian part of the search query.

Find backlink opportunities

We want to find all mentions of our brand that don’t have a link to our website yet so that we can ask the authors to add the link. As you could probably guess, we need that for SEO purposes.

The search query will look like this:

Find mentions of names

We are looking for all mentions of the artist that has a second name or a nickname (Michael Jackson). Additionally, we are not interested in the online coverage of his most successful album Thriller.

This means we have to use an operator that respects the word order (name, surname) but allows words in between. Our search string will look like this:

Exclude retweets

Now we want to exclude all retweets from the alert. All retweets start with "RT @username". So to exclude them, write down a search string like this: 

Refine your alerts regularly.

Even with the Boolean search, you might still get some irrelevant mentions. It’s hardly avoidable: machines can’t understand your intent. Yet. So after Awario gives you the first batch of mentions, look through them, and refine your alert by adding or excluding new keywords. Repeat that a couple of times until you start getting mentions you are satisfied with.

If there are any other cases you want us to advise on, please drop us a message at support@awario.com.