In this article we will simplify Boolean search logic and introduce you to tools to help you create smart searches that remove the noise. At first, this might seem complex, but there is a clear logic to its use, and with a little practice you’ll be mastering Boolean 🏆.

Looking for a quick introduction? Here is a 3-minute video covering search fundamentals.


What is Boolean?

Boolean is a type of search that allows you to combine keywords with operators (or modifiers) such as AND, NOT and OR (to name a few) to produce more relevant results.

simple_search.png

A Boolean Example

When we convert the search above to Boolean logic it looks like this:

apple AND (watch OR iwatch) NOT ("apple sauce" OR "apple juice" OR "apple orchard*")

😲

Let’s break this down to its three components to help us piece our brains back together:


How to Modify a Boolean Search

Now that we’ve wrapped our heads around this example, let’s look at two scenarios where we want to modify our original search. In the first one, we’ll broaden the search and in the second one, we’ll narrow the search.

1. Broaden the search by adding another product category (e.g. iPhone):

apple AND (watch OR iwatch OR IPHONE) NOT ("apple sauce" OR "apple juice" OR "apple orchard*")

2. Narrow the search by excluding all mentions of the iPhone:

apple AND (watch OR iwatch) NOT (IPHONE or "apple sauce" OR "apple juice" OR "apple orchard*")

Note that by adding iPhone as an exclusion term (NOT) in the second scenario, we run the risk of excluding results that include watch or iWatch, as the iPhone and the watch are product categories that are often mentioned together. We, therefore, need to carefully consider how we use the operators to structure our searches and prevent false negatives.


Syntax You Need to Know

A few notes on syntax beyond the AND, OR, NOT operators:

  • “ “ quotation marks must be used for phrases

  • ( ) parentheses are used to group alternative terms

  • * asterisk can be as a wildcard to capture different beginnings and ends of a word (e.g. “apple orchard*” gets us singular and plural forms such as "apple orchards").

Above we introduced you to Boolean search and the most basic set of operators (AND, OR, NOT).


Boolean Operators Explained

Now let's take a look at additional operators and syntax that can further refine your searches. We are going to build on our knowledge by introducing additional operators, as well as some content-specific syntax that will come in handy.

OPERATOR

APPLICATION

EXAMPLE

RESULT

AND

When you want two keywords to appear in the same document.

Apple AND watch

Both keywords are found in each document.

OR

When you want at least one keyword to appear in a document.

Apple OR iPhone

At least one of the keywords are found in each document.

NOT

When you want to exclude documents that contain the keyword.

Apple NOT “apple juice”

All documents contain apple but none include apple juice.

NEAR

When you want two keywords to appear in close proximity (same context) in an article.

Apple NEAR watch

Both keywords are found in each document, and with no more than 4 words between each other.

NEAR/N

Same as NEAR but you want to allow for more distance between the two words.

Apple NEAR/10 watch

Both keywords are found in each document, and with no more than 10 words between each other.

AND/OR

When you want to broaden the results by allowing for multiple qualifiers.

Apple AND (watch OR iWatch)

All documents include Apple and either watch or iwatch.

ONEAR

Same as NEAR and adds sequence logic.

Use this when you’d like a document to have two words in close proximity to one another and in the same order.

Apple ONEAR watch

Both Apple and watch are in the document with no more than 4 words between them, and Apple needs to be mentioned before watch.

ONEAR/N

Same as ONEAR but you want to allow for more distance between the two words.

Use this when keywords need to be within a specific distance of one another and in the same order

Apple ONEAR/10 watch

Both keywords are found in each document, and with no more than 10 words between Apple and watch, and Apple needs to be mentioned before watch.

WORD FREQUENCY

Use this syntax when you want results to include a keyword several times.

Apple{3,}

All documents must include Apple at least 3 times. Learn more about Frequency.


Special Syntax for Searching NEWS Content

Boolean helps you define what you want to search for with a great deal of specificity. You can extend this by specifying elements of an article you want to search (e.g. the title of the article or the opening text/ingress). This syntax doesn’t apply to social content.

title:”Apple” AND (watch or iwatch)

Search results will be constrained to articles where Apple is mentioned in the title of the article, and watch or iWatch are also mentioned anywhere in the article.

ingress:”Apple” AND (watch or iwatch)

Search results will be constrained to articles where Apple is mentioned in the opening text/ingress of the article, and watch or iWatch are also mentioned anywhere in the article.

🛑Note: title and ingress syntax require the use of quotation marks " " around keywords (even though it's a single word).


Special Syntax for Searching SOCIAL Content

We help you easily follow a hashtag; find content created by a specific influencer; or content that mentions a thought leader or executive of interest.

author:”tim_cook” OR author:”Tim Cook” - returns posts by Tim Cook
mention:”tim_cook” - returns posts about or mentioning Tim Cook
“tim_cook” - returns posts containing @tim_cook but not content by @tim_cook, unless “@tim_cook” is also mentioned in the post
hashtag:"applewatch" returns posts containing the hashtag

Display search results in an optimal way for consumption

Now we want to ensure that your search results are displayed to enable quick decision-making.

In most markets, Meltwater displays what we call a hit sentence (see screenshot below). The purpose of the hit sentence is to help you quickly understand the context in which your keywords are mentioned so that you can determine the relevance of the content (is it important? Should I tag it as earned media?).

Screen_Shot_2019-05-15_at_10.45.21_PM.png

The more keywords we have used to define our Boolean, the less relevant the hit sentence could appear to a user. Let's illustrate with an example where we broaden our original search with many additional qualifiers (e.g. Apple products).

apple AND (watch OR iwatch OR iphone OR ios OR macbook OR icloud OR ipad OR airpod) NOT ("apple sauce" OR "apple juice" OR "apple orchard*")

Say that we want to ensure that the product name is always displayed in the hit sentence. You can give preferential treatment (not sound parenting advice but works well here) to specific keywords.

Preference is assigned using the hat (^) character, followed by a number. The number dictates the level of preference (e.g. 10 is a higher preference than 9). Let’s look at our previous search example and play out two scenarios.

Scenario 1

Say that we wanted to give preference to all of the Apple product keywords and no priority between them (as long as we see the product name in the hit sentence we're happy), then we would do the following:

apple AND (watch OR iwatch OR iphone OR ios OR macbook OR icloud OR ipad OR airpod)^9 NOT ("apple sauce" OR "apple juice" OR "apple orchard*")

Scenario 2

Say that we wanted to give preference only to the keyword iPhone, then we would do the following:

apple AND (watch OR iwatch OR iphone^9 OR ios OR macbook OR icloud OR ipad OR airpod) NOT ("apple sauce" OR "apple juice" OR "apple orchard*")

Assigning preference is not only valuable when you evaluate the results of a search during the creation process, but it also helps any users who will utilize our search for alerts and reporting. Context helps users quickly determine the relevance of the articles in their reports, which saves time and time is 💰.


Next Steps

Boolean is a valuable skill, and that skillset takes practice to acquire. In case you haven't already tested our search above, I can inform you that it's not particularly good. Copy and paste it into our Boolean search box, apply what you've learned, and make a winner out of it. Hint 👀 - watch out for one of the product names.

Boolean_search.png

To take a deeper dive into Boolean Search Logic - check out Learn the Complete Boolean Library.


💡 Tip

Need more help? Feel free to reach out to us via Live Chat or check out our Customer Community.

Find answers and get help from Meltwater Support and Community Experts.


Did this answer your question?