Hello Community!
It’s been a while since we’ve taken a look under the hood at query writing. Well, we’re back with a look at Brackets/Parentheses in our Boolean Explained Series.
-
Case Sensitive Data
The raw
operator has been retired in favour of pointed brackets { }
. To return case sensitive results, just place the phrase you’re looking for inside the brackets.
Not case-sensitive: British Telecom OR BT
Will likely find mentions of both “British Telecom” and “BT:, but might also include misspellings of the word “but” or the acronym for “Bad Trip”, because we haven’t specified that BT must be case-sensitive (which is how references to the brand BT are typically written).
Case-sensitive: British Telecom OR {BT}
This query specifies that BT should only be included if it is written in the same case-sensitive format as the word inside the pointed brackets.
Note: Will only retrieve Mentions where upper case letters are used in the exact way specified inside the brackets. Upper case matching works for words with up to 20 characters from 1st July 2021 and up to 5 characters prior to that.
-
Tidy Up Your Query!
It’s quite common to see something like this
economy AND url:guardian.com OR url:sun.com OR url:times.com
Rather than just use brackets which could save you time and keep your query tidier
economy AND url:(guardian.com OR sun.com OR nytimes.com)
Similarly with the NOT
operator. Instead of apple NOT juice NOT pie NOT sauce
Try apple NOT (juice OR pie OR sauce)
-
Combining Tasks
Parentheses are also useful for combining a bunch of search tasks together and specifying the order. For example, what if you were monitoring people discussing apple pies and peach pies
(plural or singular) on social networks, but you don’t want to capture any results that mention frozen pies. You can combine a Boolean query to find the two types of fruit combined with plural or singular forms of pie, and then remove any frozen mentions.
((apple OR peach) AND (pie OR pies)) NOT frozen
Set 1: (apple OR peach)
= results containing the words apple or peach
Set 2: (pie OR pies)
= results containing the words pie or pies
Set 3: ((apple OR peach) AND (pie OR pies))
= results with both sets of words in them (e.g., apple pie, apple pies, apple cobbler pie, peach pie, peach pies, peach homemade pie, frozen apple pies)
Final set: NOT frozen
= results in set 3 and any page that has the word frozen in it is removed.
-
Using with <<<comment tags>>>
It can be particular efficient to use Brackets in collaboration with comment tags. Especially, if you're collaborating on queries (usual with agencies) and need to understand what the query/keywords are about or for because people write boolean in lots of different ways so comment tags make it easier to understand what on earth someone was thinking when they were neck deep in boolean (even yourself, looking back!).
<<<journalists>>> author:(......)
<<<Influencers>>> author:(.....)
-
Nesting NEAR/x
Nesting NEAR/x
within a NEAR/xclimate NEAR/7 (recycle OR sustainable OR (green NEAR/1f (deal OR investment)) OR "emergency")
-
Double Negatives
This one hurts. Let’s look at an example:
NOT (country:rA TO ZZ] NOT country:(“GBR” OR “USA”))
In this example we are excluding data from all countries, but not excluding data from GBR or the USA
NOT this, but NOT NOT these. We are essentially saying remove all of this, but not this. Kind of like saying only pull data from GBR OR USA but it will also include data where we have no location metrics, which is helpful for working in certain markets. This could be also be helpful for reducing the impact of news sites and online forums creating unwanted noise in your data.
Got any more of your own to add? That’s what this is for… just reply below and share it with the Community.
See more posts in the Boolean Explained series here.