Skip to main content

How Do Boolean Operators Work?

C
Written by CX Enablement
Updated over 2 weeks ago

This guide covers Boolean Queries but if you'd like our AI Assistant to help you with this - find out more here.

Introduction to Boolean

This guide is intended to give you a jump-start in writing more powerful and targeted queries for your Mention Streams. Before creating complex Boolean searches, we recommend exploring CisionOne’s simple keyword search to locate coverage. While Boolean can be a powerful tool to refine results, many of our customers use simple keyword searches to find relevant results quickly. If you want to learn more about how you can leverage our advanced Boolean operators, keep reading.

TIP: CisionOne Boolean uses a slightly different Boolean syntax to other Cision platforms like Next Generation Comms Cloud.

What is a Boolean query?

A Boolean query is a more complex search involving operators such as AND, OR, NOT, NEAR and Parentheses ( ). This can be an effective way to refine your search results and create a more advanced search for media coverage in CisionOne. To start writing in Boolean, select the "Boolean query" option when creating a Mention Stream.

What are Boolean operators?

A Boolean query will involve at least one (or a combination of) these key operators:

Operator

Description

Example

AND

The AND operator, used in conjunction with multiple terms, requires that all terms must exist in an article for it to match.

"Apple" AND "Pie"

Both Apple and Pie need to be within the article.

OR

The OR operator broadens the search to include articles that contain one or more of the search terms.

"Apple" OR "Pie"

Either Apple or Pie can be in the article.

NOT

The NOT operator excludes articles that contain specified terms in the article.

"Apple" NOT "Pie"

Apple appears in the article, but not Pie. If Pie appears, the article is not ingested.

()

(Parentheses) group terms together so that operators such as AND and OR can be applied to groups of keywords.

("Apple" OR "Peach") AND "Pie"

Either Apple or Peach appears in the article as well as Pie.

NEAR/x

Searches or excludes for a group of keyword(s) within a certain amount of words of another group of keyword(s). This is regardless of whether the words come before or after each other. We don’t recommend using more than NEAR/15. This cannot be used in conjunction with text.case_sensitive operator.

("Apple" NEAR/12 "Pear")

The word Apple appears within 12 words of the word Pear in the article. Apple can appear before or after Pear. If Pear appears more than 12 words away from Apple, the article will not ingest.

ONEAR/x

Searches for a group of primary keywords to be mentioned before a secondary set of keywords, and within a certain amount of words of each other. Apple will be mentioned before Pie, but within 3 words of each other. We don’t recommend using more than ONEAR/15. This cannot be used in conjunction with text.case_sensitive operator.

("Apple" ONEAR/3 "Pie")

The word Apple appears within 3 words before the word Pear in the article.

General Guidelines

Following these simple guidelines will help you maximize accuracy and minimize the likelihood of capturing unintended results with your Boolean queries.

Correct

Incorrect

Capitalize all Boolean operators

"Apple" AND "Pie"

"Apple" and "Pie"

Place all keywords in plain quotation marks

"Apple" AND "Pie"

“Apple AND pie

Separate searches within a query by placing each search in plain parentheses

("Apple" AND "Pie") OR ("chocolate" AND "milk")

"Apple" AND "Pie") OR ("chocolate" AND "milk"

Place everything before and after a NOT operator in plain parentheses

("Apple" AND "Pie") NOT ("chocolate" AND "milk")

"Apple" AND "Pie" NOT "chocolate" AND "milk"

Standard Boolean Queries

A standalone Boolean query involves a single keyword, containing one word (e.g. "finance") or multiple words surrounded by plain quotation marks (e.g. "interest rates").

Example 1

"finance" AND "interest rates"

Example 2

"cost of living" OR "household expenses"

Example 3

"personal finance" NEAR/5 "interest rates"

Example 4

"personal finance" NOT "interest rates"

Blended Boolean Queries

A Blended Boolean Query is a more complex search involving multiple operators to contextualize your results even more precisely. Parenthesis ( ) are required in all cases and must be used correctly to maximize accuracy.

Example 1

("cost of living" AND ("lifestyle" OR "lifestyles")) NOT "house prices"

This search is looking for the phrase “cost of living” and either “lifestyle” or “lifestyles” but not if the phrase “house prices” appears.

Example 2

("house price" OR "house prices") NEAR/5 ("economy" OR "economic" OR "economics")

The phrase “house price” or “house prices” needs to appear within 5 words before or after “economy”, “economic” or “economics”.

Example 3

("Australian Government" OR "Federal Government") NOT ("United States" OR "USA" OR "America")

The article mentions either phrase “Australian Government” or “Federal Government” but not if it also mentions “United States”, “USA”, or “America”.

Example 4

("Election" AND ("President" OR "Vice President")) AND ("interest rate" OR "interest rates")

The article must mention “Election” and either “President” or “Vice President” and also either “interest rate”or “interest rates”.

Advanced Boolean Operators

FIRST/X

Searches for a keyword within the first number of words within an article. This applies to Online, Print, and Magazines.

("Apple" FIRST/100)

UNLESS

Adds additional context and stipulations to an exclusion. The unless operator can only be used in the NOT portion of a query.

"Apple" NOT ("Apple" UNLESS "Pie")

The article should not include the word Apple, unless Pie is also mentioned in the article.

ATLEAST/x

When wanting to search for a keyword mentioned in the same article multiple times. Each keyword must have the operator and this operator must be placed at the end.

(("Apples" ATLEAST/3) OR ("Pears" ATLEAST/3))

Either Apples or Pears must be mentioned in the article at least 3 times

url:

Search or exclude keywords across specific subsections of a website.

Only content from https://edition.cnn.com/ the website would be ingested. Make sure mediatype ONLINE is selected.

title:

Searches for keyword(s) within the headline of an article

title:"Apple"

Apple” must appear in the headline

author:

Search or exclude a set of keywords across any article written by a certain journalist. Can also search any article written by that journalist. Only applies to Online, Print & Magazine Journalists, and author name must exactly match the name in the byline.

(employment OR employer OR wage) AND author:"Harry Wallop"

author:"Harry Wallop"

author:("Susan Nerberg" OR "David Tooley")

text.case_sensitive:

Searching a case sensitive keyword(s). Can be used with a NEAR or ONEAR operator under specific circumstances (see examples below).

text.case_sensitive:"Apple"

medium:

Search or exclude a specific media type.
Mediums include:

  • Online

  • Print

  • Magazine

  • TV

  • Radio

  • Podcast

  • Social

TIP: Always ensure that the corresponding Media Type is selected within the Mention Stream, otherwise no content will appear.

"Interest rates" AND medium:(Online OR Print)

"Interest rates" NOT medium:(TV OR Radio)

location:("Country Name")

Search for coverage within a specific country or countries

TIP: Always ensure that the corresponding Location is selected within the Mention Stream, otherwise no content will appear. E.g. If you are searching for a city in Canada, ensure that Canada is selected as a location filter.

When you add the clause location: "Canada" you are telling the Mention Stream to match only content where the source location is set EXACTLY to Canada. Outlets set to locations within Canada (cities or regions) will not be included.

If you want to include ALL content from Canada, then you we advise using the Location filters.

location:("Canada" OR "United States of America")

location:("City Name")

Search for coverage within a specific city or cities.

TIP: Cities with the same name can be located in different areas e.g. Birmingham in the UK, or Birmingham, AL. Manchester in the UK, or Manchester, RI. We recommend adding parameters to ensure the right city is identified.

location:("Birmingham" OR "Manchester")

language_codes:

Search for coverage written in a specific language/s. Full list of language codes can be found in appendix.

language_codes:"es" AND "manzana"

language_codes:"fr" AND ("Olympics" OR "Jeux olympiques")

program:

Search for coverage on a particular TV show. This does not apply for Radio programs.

program:"BBC World News"

program:"CBS News Morning" AND "election"

Wildcard (*)

Identify various forms of a word. For example sail* will capture "Sail" "Sailing" "Sailed" "Sailor" "Sailboat". Use this operator sparingly: more likely than not, there are more possible variants than what you anticipated which can lead to runaway searches and irrelevant content. Using wildcards may slow loading times for your Mention Streams, so we recommend against using these unless necessary.

Sail*

The system will search for the letters “S-A-I-L-” and ALL combination of letters after that

impact_score_grade:

Search or exclude a specific impact score grade. Grades include:

-High

-Medium

-Low

impact_score_grade:"High" AND "Apples"

impact_score_grade:"Medium" AND "Apples"

impact_score_grade:"Low" AND "Apples"

Using the Boolean Editor

When editing a Mention Stream, you’ll see two options 1) Keyword/s 2) Boolean Query. If you click on the Boolean Query option, you’ll see a black box with a sample query in it. This is the Boolean Editor, which allows you to create and edit Boolean queries.

Color Coding: The key operators are color coded so that you can easily identify when a Boolean operator is active.

KEYWORDS = light green

AND = yellow

OR = blue

NOT = red

NEAR/ = purple

FIRST/= purple

Suggested Operators:

If you begin typing the first letters of an operator, you’ll notice that CisionOne will give you the option to prefill the rest of the operator from a list of common operators. E.g If you type ‘N’ it will suggest the NEAR/n operator as well as the NOT operator for you to select. This allows you to quickly write Boolean without having to refer back to this Boolean guide to refer to exact operators.

Stream Filtering Guidelines

The optimal way to refine your mention stream beyond Boolean queries is by utilizing specific filters. These include:

  • Language Filters: Helps refine results to mentions in the language of choice.

  • Location Filters: Limits results to mentions from targeted geographic areas.

  • Topic Filters: Assists in narrowing down results to subjects of interest.

Results count:

As you start to type in words, you’ll notice a counter which gives you an indication of the overall number of results associated with your query from the last 30 days e.g 55,359 results were found for the below query over the last 30 days. This allows you to identify whether a query is too broad or restrictive. This can also be very effectively used with the NOT operator and will display the number of results specifically excluded by the not operator.

Expand/Full Screen button:

If you’re a Boolean pro, you might be writing very long queries. You can use the drag button in the bottom right-hand corner of the Boolean editor to make this larger, or click the "enter Fullscreen" button to expand the editor to cover the full screen.

Common Issues in Boolean Query Setup

Misuse of Keyword Search vs. Boolean Text Box

One common error involves entering Boolean operators (e.g., AND, OR, NOT) directly into the keyword search field instead of the designated Boolean text box. This can lead to unexpected behavior or filtering issues where irrelevant mentions are included in the results. Always ensure that Boolean syntax is placed in the correct input field.

Common Boolean Case Studies

How do I search by Location?

Use the location: operator to filter down coverage to a country or city level. N.B. There are no Boolean Operators for DMA.

Operator

Example

location:("Country Name")

location:("Canada" OR "United States of America")

location:("Switzerland" OR "Estonia")

location:("City Name")

location:("New York")

location:("Birmingham" OR "Manchester")

TIP: Make sure that you also have your Media Type Location Filters set to international when using the location operator – otherwise you won’t see any results.

How do I search by Language?

Use the lanaguage_codes: operator to filter down coverage to a single language or multiple languages.

Operator

Example

language_codes:"language code"

language_codes:"es"

language_codes:"fr" AND ("Olympics" OR "Jeux olympiques")

language_codes:("fr" OR "it") AND ("Olympics" OR "Jeux olympiques" OR "Olimpiadi"))

language_codes:"en" = English

language_codes:"es" = Spanish

language_codes:"fr" = French

language_codes:"de" = German

language_codes:"it" = Italian

language_codes:"el" = Greek

language_codes:"pt" = Portuguese

TIP: You can find a full list of Language codes in the appendix below.

How can I use a proximity operator and a text case sensitive operator at the same time?

You can combine the proximity (NEAR/X) operator and the proximity operator (text.case_sensitive: ) using and AND connector.

Operator

Example

NEAR/X

text.case_sensitive:

("CNN" NEAR/5 ("election" OR "electoral")) AND (text.case_sensitive: "CNN")

How can I track owned social media pages and filter to only these pages in CisionOne Social?

Use a combination of type:facebook_post or type:tweet and author: to filter down coverage to a single Facebook or Twitter(X) page.

Operator

Example

("KEYWORD") AND (type:facebook_post AND author:"FacebookPage")

(“Interest Rates") AND (type:facebook_post AND author:"ABC News")

("election") AND (type:facebook_post AND author:"BBC News")

("KEYWORD") AND (type:tweet AND author: "@TwitterHandle")

("election") AND (type:tweet AND author:"@BBCWorld")

How can I exclude a specific website from my results?

Use the url: operator in conjunction with a NOT operator to exclude a single website or multiple websites from your results.

Operator

Example

NOT (url: "URL")

"election" (NOT (url:" https://www.bbc.co.uk/news "))

Can you filter by impact score?

Use the impact_score_grade operator and select one or multiple grades.

Operator

Example

(impact_score_grade:("High" OR "Medium" OR "Low") AND (KEYWORD))

(impact_score_grade:("High") AND (election))

(impact_score_grade:("Medium" OR "Low") AND (election))

How do I search for a particular podcast show name?

Use the source.name: operator and add podcast name.

Operator

Example

source.name

source.name: "AI & Data Today”

source.name: "The Daily Wire"

The podcast name must exactly match the name we have in our Database, so please make sure to use exact wording. You must have podcast monitoring included in your agreement in order to be able to use this operator.

How can I apply NEAR parameters with multiple terms before and after?
You can use this operator with multiple keywords included. Here's an example:

Operator

Example

NEAR/X

("Apple" NEAR/12 ("Pear" OR "Berry" OR "Banana" OR "Strawberry"))

(("pastry" OR "dessert" OR "ice-cream")

NEAR/12 ("Pear" OR "Berry" OR "Banana" OR "Strawberry"))

Troubleshooting Boolean Query Issues in Mention Streams

Boolean queries are a powerful tool within Cision for filtering and retrieving relevant mentions. However, incorrect setup or use can lead to issues such as unwanted mentions being included in your stream. This guide will help you troubleshoot and optimize your Boolean queries to avoid common pitfalls and ensure that your mention streams display accurate results.

Frequently Asked Questions

Is there a limit to the number of keywords or characters I can use in a Boolean query?

There is no limit to the number of words or characters you can input into the Boolean editor, however the highlighting in the editor will not display after 10,000 characters. Our recommendation would be to organize keywords through multiple Mention Streams rather than creating queries with tens of thousands of keywords.

How large or small can the NEAR/x and FIRST/x parameter be used?
We recommend limiting the NEAR/x operator to 20-25 words. Otherwise, the search becomes too general.

Does text.case_sensitive: work only on an article's body of text or will it apply to the title/headline as well?
The case sensitive operator applies to both the headline and body of text.

Can I track backlinks to specific landing pages e.g. links back to different pages on a website: News, Product, About etc.?

There is no Boolean operator to support tracking backlinks to specific landing pages. We recommend integrating your CisionOne account with Google Analytics and using the PR Referral Traffic widget in Instant Insights to review backlinks.

Is there a Boolean operator to include tagged content in a Mention Stream?

No, there is not a Boolean operator available that specifically targets Tagged content from a Tagged mention stream. We recommend tagging all the items within a specific timeframe and generating a report using that timeframe.

Is there a way to search for broadcast clips from a specific news outlet?

Yes, you can use the program: operator which allows you to isolate television programs by name, however there is no equivalent operator available for radio programs.

How do I search for coverage with a particular sentiment? E.g. Just want to see negative sentiment articles?

No, there is not a Boolean operator available that specifically targets specific sentiment scores. We recommend using the Mention Stream level filters to filter your results by Sentiment score.

Additional Recommendations

  • Regularly review your mention stream performance to identify any unrelated mentions or gaps in desired coverage.

  • Consult Cision’s AI Assistant if advanced Boolean query setups are required beyond basic functions. Find out more here.

Appendix

Full list of language codes:

Language

Code

Language

Code

Language

Code

Language

Code

Language

Code

Abkhazian

ab

Dutch, Flemish

nl

Japanese

ja

North Ndebele

nd

Spanish, Castilian

es

Afar

aa

Dzongkha

dz

Javanese

jv

South Ndebele

nr

Sundanese

su

Afrikaans

af

English

en

Kannada

kn

Ndonga

ng

Swahili

sw

Akan

ak

Esperanto

eo

Kanuri

kr

Nepali

ne

Swati

ss

Albanian

sq

Estonian

et

Kashmiri

ks

Norwegian

no

Swedish

sv

Amharic

am

Ewe

ee

Kazakh

kk

Norwegian Bokmål

nb

Tagalog

tl

Arabic

ar

Faroese

fo

Central Khmer

km

Norwegian Nynorsk

nn

Tahitian

ty

Aragonese

an

Fijian

fj

Kikuyu, Gikuyu

ki

Sichuan Yi, Nuosu

ii

Tajik

tg

Armenian

hy

Finnish

fi

Kinyarwanda

rw

Occitan

oc

Tamil

ta

Assamese

as

French

fr

Kirghiz, Kyrgyz

ky

Ojibwa

oj

Tatar

tt

Avaric

av

Western Frisian

fy

Komi

kv

Oriya

or

Telugu

te

Avestan

ae

Fulah

ff

Kongo

kg

Oromo

om

Thai

th

Aymara

ay

Gaelic

gd

Korean

ko

Ossetian, Ossetic

os

Tibetan

bo

Azerbaijani

az

Galician

gl

Kuanyama, Kwanyama

kj

Pali

pi

Tigrinya

ti

Bambara

bm

Ganda

lg

Kurdish

ku

Pashto, Pushto

ps

Tonga (Tonga Islands)

to

Bashkir

ba

Georgian

ka

Lao

lo

Persian

fa

Tsonga

ts

Basque

eu

German

de

Latin

la

Polish

pl

Tswana

tn

Belarusian

be

Greek, Modern

el

Latvian

lv

Portuguese

pt

Turkish

tr

Bengali

bn

Kalaallisut, Greenlandic

kl

Limburgan

li

Punjabi, Panjabi

pa

Turkmen

tk

Bislama

bi

Guarani

gn

Lingala

ln

Quechua

qu

Twi

tw

Bosnian

bs

Gujarati

gu

Lithuanian

lt

Romanian, Moldavian, Moldovan

ro

Uighur, Uyghur

ug

Breton

br

Haitian

ht

Luba-Katanga

lu

Romansh

rm

Ukrainian

uk

Bulgarian

bg

Hausa

ha

Luxembourgish, Letzeburgesch

lb

Rundi

rn

Urdu

ur

Burmese

my

Hebrew

he

Macedonian

mk

Russian

ru

Uzbek

uz

Catalan, Valencian

ca

Herero

hz

Malagasy

mg

Northern Sami

se

Venda

ve

Chamorro

ch

Hindi

hi

Malay

ms

Samoan

sm

Vietnamese

vi

Chechen

ce

Hiri Motu

ho

Malayalam

ml

Sango

sg

Volapük

vo

Chichewa

ny

Hungarian

hu

Maltese

mt

Sanskrit

sa

Walloon

wa

Chinese

zh

Icelandic

is

Manx

gv

Sardinian

sc

Welsh

cy

Church Slavonic

cu

Ido

io

Maori

mi

Serbian

sr

Wolof

wo

Chuvash

cv

Igbo

ig

Marathi

mr

Shona

sn

Xhosa

xh

Cornish

kw

Indonesian

id

Marshallese

mh

Sindhi

sd

Yiddish

yi

Corsican

co

Interlingua

ia

Mongolian

mn

Sinhala, Sinhalese

si

Yoruba

yo

Cree

cr

Interlingue, Occidental

ie

Nauru

na

Slovak

sk

Zhuang, Chuang

za

Croatian

hr

Inuktitut

iu

Navajo, Navaho

nv

Slovenian

sl

Zulu

zu

Czech

cs

Inupiaq

ik

Somali

so

Danish

da

Irish

ga

Southern Sotho

st

Divehi, Dhivehi, Maldivian

dv

Italian

it

Did this answer your question?