Skip to main content
Boolean Basics

This article will introduce you to the basics concepts of using Booleans

Ashvin Jalabhay avatar
Written by Ashvin Jalabhay
Updated over a year ago

Learning Outcomes

  • You will learn what operators can be used when creating a Boolean expression

  • You will understand how these operators affect a data set


What is a Boolean?

Boolean expressions are the blueprint for all your TRAC searches!

These types of expressions produce either a true or false value; in terms of TRAC, this means that content either matches the terms of your query and is pulled into your Results, or does not match and is not collected by your search.


What operators can be used in a Boolean expression?

There are 3 main operators when working with Boolean expressions:

  • AND

  • OR

  • NOT

Pulsar also has a few platform-specific operators that help you tailor your results even further. More information on these operators can be found in our Full Boolean operator guide. For now, we’ll keep our focus on the main 3 operators.

We can visualize boolean expressions using Venn diagrams; these visualizations will be used throughout to help you get a better grasp on what would be included in your Results based on the example queries.


AND

Using terms in AND means that a piece of content must match BOTH terms. The AND operator helps narrow down your results as it creates a set of restrictions that only specific pieces of content will match.

For example:

apple AND orange

When the platform runs a query for the data set, it must match both the keyword apple and the keyword orange. If the content matches only the keyword apple, it would not be pulled into your results; likewise, if the content matches only the keyword orange, it would also not be included in your results.

Another way to think of this is by using the visual below

The boolean term

apple AND orange

would be the conjunction of the two circles:

A more complex example of this would be

apple AND orange AND tree


OR

When putting terms in OR with one another, you are signaling to the platform that you’d like to pick up content that matches ANY of the terms listed. In contrast to the AND operator, the OR operator helps widen the range of results you will collect.

For example, the following boolean

apple OR orange OR tree

would bring back content that matches all three terms, only matches apple, only matches orange, only matches tree, or that matches any combination of those three terms.


NOT

The NOT operator is the simplest of the bunch. Simply put, you would use this term to specify what you do NOT want in your search.

The following boolean expression will pick up content that includes the keywords apple or orange but will exclude any content that has any reference to tree. This will also exclude any mentions of apple trees or orange trees, for example.

(apple OR orange) AND NOT tree


Order of Operations

  1. AND

  2. OR

  3. NOT

The AND operator is prioritized over the other operators, meaning in the following statement

apple OR orange AND tree

the orange AND tree portion is processed first


Parentheses

Parentheses can be helpful in cleaning up your boolean expression and making it more readable. The main use for parentheses, however, is to be able to bypass the order of operations and indicate to the platform how you’d like your terms to be grouped and processed.

The boolean expression

apple OR orange AND tree

would be evaluated as shown below:

However, you could reformat the expression to process the apple OR orange portion first by enclosing the section in parentheses:

(apple OR orange) AND tree

Comparing the visualization of the two forms of expression, we can see how parentheses can have a great impact on the content your search may pull in.


You can see from the visuals that these expressions can become very complicated very quickly by adding just a few more terms. This is why we recommend keeping your expressions as simple as possible, while also making sure the terms you are using are specific enough so you avoid irrelevant results.

Fine-tuning boolean expressions can be a daunting task, luckily your Customer Success Manager can help you develop the right query for your team and give you tips for your specific use cases. We also have great video resources available to help you navigate the boolean setup.

Or jump right into it and try your hand at creating your own boolean expressions using our Full Boolean operator guide!


We hope you enjoyed reading this article! 📚

If you have any questions or would like to learn more, please don't hesitate to reach out to our support team via live chat. 🚀

Did this answer your question?