Вы находитесь на странице: 1из 10

Analytics / Data Sources

Advanced Query Operators

Updated: January 8 2016

There are many more Query writing options than just the Basic Operators. This Advanced Query Operators guide will look at the
following in detail:

will find Mentions of the exact phrase apple juice


the proximity operator ~ (tilde)

apple juice~5

and Mentions in which the phrase can be made


by swapping less 5 or less adjacent words

the NEAR/x operator

(apple OR orange)
NEAR/5
(smartphone OR phone)

will find Mentions of apple within 5 words of


smartphone or phone and Mentions of orange
within 5 words of smartphone or phone

logitech NEAR/2f keyboard

Will find Mentions where 'logitech' appears before


'keyboard' with 2 or fewer words in-between e.g.
'logitech keyboard', 'Logitech Bluetooth Keyboard',
'Logitech Solar Keyboard' etc.

the raw: operator

raw:Google+

will find Mentions of Googles social networking


service written with a capital G and a plus sign.
NB: if the raw: operator is not used for Google+ all
Mentions of Google will be found because the +
will be ignored

the location operators

city:bedo AND apple juice

will only find Mentions of the exact phrase apple


juice that have been identified as from the
German city of Berlin.

the site: operator

site:twitter.com AND apple juice

will find Mentions on a particular site, e.g. any


Mention of apple juice on Twitter

the url: operator

url:msn.com/news AND Simon


Cowell

will find Mentions on a particular part of a site, e.g.


anyMention of Simon Cowell on the news section
of the MSN website

links:msn.com

Will find Twitter Mentions containing links to the


msn.com website. Note: in this case if the links:
operator had not been used, Tweets containing

the NEAR/xf operator

the links: operator

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

shortened links to msn.com would not have been


picked up

the author: operator

author:justinbieber

will find Mentions across all page types with a


specific author name, e.g. tweets, blogs, forums,
by any author called justinbieber

the title: operator

title:chevrolet

will find Mentions where chevrolet" is used in the


web page title

the hashtags: operator

hashtags:oscars

All Mentions of the hashtag #oscars on Twitter


and Instagram

the at_mentions: operator

at_mentions:SimonCowell

All instances of a specific Author, in this instance


Simon Cowell, being Mentioned on Twitter

the replacement operator ?

customi?e

will find Mentions where ? can be replaced by


another letter, e.g. customise, customize

the wildcard operator *

complain*

will find Mentions with the root word complain,


e.g. complain, complaints, complained etc

The Proximity Operator - the Tilde ( ~ )


The Proximity Operator (represented by the tilde character, ~ ) allows you to add some flexibility to where words in a phrase
appear in relation to each other. The tilde character is always used after a phrase in quotes and followed immediately by a
number like this:
chevrolet impala~10
This will return Mentions where chevrolet appears within 10 words of impala, in the order specified, or within 9 words of each
other in the opposite order. This is due to the fact that the Proximity Operator counts how many times it has to swap the
positions of adjacent words until the phrase is made. If the amount of moves is equal to or less than the specified number, the
Mention will be included. You can use any number you like with the Proximity operator.
Its also possible to use the proximity operator on longer phrases (i.e. phrases with more than 2 words) like this:
chevrolet impala 2014~15
Remember, the Proximity Operator counts the number of moves it would need to make to make the exact phrase, so the order
you specify the terms is important.
As the wildcard and replacement operators (* and ? respectively) are not compatible with quotation marks, if you wish to use
either of these operators within the proximity operator, it is instead advised that you use the NEAR/x operator. If you wish to
search for the terms in a specific order (i.e. Mentions where chevrolet comes before impala) you should use the NEAR/xf
operator.

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

The NEAR/x Operator


The NEAR/x operator is similar to the proximity operator, but is a little more flexible. The syntax for the NEAR/x operator is as
follows:
chevrolet NEAR/10 impala
This will match Mentions where chevrolet appears within 10 words of impala, in any order. Unlike the Proximity Operator, the
NEAR/x Operator simply counts the number of words between the two terms, so the order of the terms doesnt matter. An
important flexibility with NEAR/x is that you can combine it with other operators (such as AND, OR and NOT) like this:
(chevrolet OR chevy) NEAR/10 (impala OR malibu)
This Query is similar to:
chevrolet impala~10 OR chevy impala~10 OR chevrolet malibu~10 OR chevy malibu~10
Writing your Query in this manner will reduce the number of characters in total. The first (NEAR/x) version of this Query is also
much simpler to read, and will be easier to maintain if you need to edit your Query in future. the NEAR/x operator is always
written in capital letters.
NB: Field Operators (specifying Operators ending in a colon : ) will only work with the NEAR/x Operator if applied to both sides,
like this:
hashtags:coke NEAR/10 hashtags:smile
please note that the field operator must be actually written on both sides. brackets cannot be used to nest the terms under one
field Operator, due to how NEAR/x operates.

The NEAR/xf Operator


The NEAR/xf operator works in the same way as the NEAR/x operator, with one important difference. Where NEAR/x will find
Mentions of the terms in any order, NEAR/xf will only find them in the specified order, from left to right. for instance:
chevrolet NEAR/2f impala
Would return any Mentions where chevrolet appears before impala with 2 or fewer words in-between e.g. chevrolet impala
and chevrolet bel air impala, but not "impala chevrolet" or "chevrolet malibu and saw an impala"
Just like NEAR/x, the NEAR/xf operator will only work with raw: if raw: is applied to both sides of the statement. This applies to
all field operators (operators ending in a colon : ).

The raw: Operator


The raw: operator is useful when you want to look for non-alphanumeric characters (characters other than letters and
numbers) in your Query. Normally, non-alphanumeric characters in a Query are treated as whitespace. The raw: operator can

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

also be used to look for terms written in the case (upper or lower) you use to write the term. The raw: operator is written as the
word raw (in lowercase) followed by a colon, immediately followed by the Query term like this:
raw:Google+
The above Query string will look for Mentions of Google+, but will return Mentions only when Google+ is written as it is in the
Query i.e. with a capital G and immediately followed by the + sign. A popular way around this is use brackets as so:
raw:(Google+ OR google+ OR Google + OR google +)
Remember, as previously stated, the raw: operator will only work with the NEAR/x or NEAR/xf operators if it is used on both
sides of the statement. Another thing to note is that, to pick up characters that are also operators (such as the * ! ? ) youll need
to use quotation marks around the term. This instructs the system not to use the symbol as an operator. For example:
raw:("*alliance" OR "*Alliance" OR "*ALLIANCE")
NB: The raw: operator is not compatible with Asian languages.

The Location Operators


The location operators can be used to restrict results to those from a particular location. There are 5 location operators:
continent:, country:, state:, county: and city: (there is also the location: operator, which has the same functionality as the
country: operator).
The location operators are used in the following way:
country:uk
This is only really useful when combined with other terms using the AND operator. Generally to restrict the results you receive
for your Query to a specific location, you would first put the entire Query in brackets and add the location operator with AND like
this:
(chevrolet NEAR/15 (impala OR malibu)) AND country:uk
This Query will return mentions of chevrolet within 15 words of either impala or malibu, with the additional stipulation that
Mentions come from the UK.
You can use the Location selector within the Query builder to easily find the location code you require. The Location selector is
located at the top right above the Query text field. Simply enter the location into the search field, and you will be presented with
a location code that you can then copy and paste into your Query. Location operators are always lower case.
Please note that city: county: and state: data is not always available on Mentions. Here it depends on the site where the
Mention is captured and whether this provides granular location metadata. If granular location data is not available the top
level domain location is used. For instance, Facebook does not provide location data, so all the location of all posts from
Facebook have the US as their location - where the domain is registered. Please bare this in mind when restricting your
Mentions by location. It may be a good idea to re-add Facebook data to the Query using the site: operator (outlined below), like
this:

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

(chevrolet NEAR/15 (impala OR malibu)) AND (country:uk OR site:facebook.com)

The site: Operator


The site: operator allows you to specify a site from which to retrieve mentions (or exclude mentions from when used with the
NOT operator). The site: operator syntax is as follows:
site:twitter.com
When using the site: operator, you generally do not need to include the www. part of the domain (if it exists). Excluding it will
automatically include any subdomains, including www. The site: operator is usually used on an entire query by wrapping the
query in brackets and adding the site: operator with AND or NOT. For example:
((chevrolet OR chevy) AND impala) AND site:twitter.com
This query will return all mentions of chevrolet and impala, or chevy and impala from just Twitter. As mentioned
previously, using the NOT operator will exclude the specified site from your results. For example:
((chevrolet OR chevy) AND impala) NOT site:twitter
This query will return results only from sites other than Twitter. Please note that, in the above example we have not included the
.com of twitter. This is perfectly valid; it is not necessary to write the site with the country domain unless you are looking for a
specific domain.
The site: operator can only be used to search the top level of the domain. It cannot be used to search for Mentions from a
particular part of a site. To do this, you would instead need to use the url: operator, outlined below.

The url: Operator


The url: operator is similar to the site: operator but while the site: operator works on just a domain, the url: operator can be used
to march any part of the URL of a mention.

The following example will return only mentions of new york giants" from the Sport section of the ABC News website:
new york giants AND url:"abcnews.go.com/sports"
This is because all articles in the sport section of the ABC news web site have URLs that begin abcnews.go.com/sports. Note
the use of the quotation marks; this is to ensure that the whole URL is taken into account. You can also use url: to exclude sites
that contain certain terms anywhere in their url. For instance:

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

NOT url:(jobs OR careers)


would exclude www.amazon.com/gp/jobs and ckscience.co.uk/news/chemical-careers, but still include www.jobsite.co.uk.
To also catch this site, you would need to use a wildcard operator, like so:
NOT url:(jobs* OR careers*)
The url: operator is compatible with both the wildcard and replacement operators, * and ?. If you do not include a specific page
path url, the url: operator will work in the same way as the site: operator and search the whole domain.

The links: Operator


The links: operator allows you to retrieve Twitter Mentions containing links to a website, even if the links have been shortened.
This operator is extremely powerful when measuring the success of content marketing and social presence on Twitter.
The links: operator will match against any part of the link URL. for instance, if you wanted to find Tweets that link to anywhere
on the apple website, you could write:
links:apple.com
This would return both links to apple.com/uk/itunes, as well as itunes.apple.com/us.
The links: operator can also be used with both NEAR/x and wildcard operators. For instance, you could write:
links:which.co.uk NEAR/10 links:tablet*
This would return, for example, both http://blogs.which.co.uk/technology/tablets-2/microsoft-beats-apples-ipad-air-2-tofastest-tablet-title/ and http://www.which.co.uk/news/2015/06/which-tests-find-new-best-buy-tablet---and-its-not-thesurface-3-407047. When using the links: with the NEAR/x operator, the links: operator must be placed on both sides of the of
the NEAR/x.
The links: operator is particularly powerful when searching for links to a full URL, like so:
links:http://www.benandjerry.com.au/flavours/reef-scoop-tour
This string would return Tweets that link to that specific URL; this is extremely useful for Queries aimed at tracking campaigns
on Twitter. When searching for links to an entire URL, quotation marks should be used to ensure the entire URL is used in the
search.
Please note that the links: operator only searches links within Twitter Mentions.

The author: Operator


The author: operator can be used to retrieve mentions from specific authors. An author can be the writer of a blog or news
article, a forum user name or a Twitter handle. Not every mention has an author associated with it, but where we can determine
the source of a mention you can use the author: operator in your query to specify a particular author. The author: operator is
used like this:
author:justinbieber

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

The above query on its own would return all Tweets from Justin Bieber (as justinbieber is his Twitter handle) but also any blog
or forum posts from anyone using that username. The author: operator will only match the exact author name given, so names
like justinbieber95 wouldnt be picked up. If you wanted to restrict this to just Justin Biebers tweets, you could do so with the
site: operator like this:
author:justinbieber AND site:twitter.com
It should be noted that the author: operator recognises special characters in names and is not case specific.
It is advised not to use the author: operator with the wildcard ( * ) operator, as the operator doesnt always work well with the
way we capture new Tweets. Instead where required it is better to add the separate author names, like so:
author:(Playstation OR PlaystationUK OR PlaystationEU)
NB: The author: operator is not compatible with Facebook API searches.

The title: Operator


The title: operator can be used to search for text in a web page title. The title of a web page typically appears in the Title bar of
your web browser.

The title: operator is used in the following way:


title:butler
This Query string would match the mention in the screenshot above. Note that normally, any terms that appear in the title will
appear in the web page itself, so using the title: operator may not be necessary. Also be aware that there is no standard use of
page titles. Some websites simply use the same page title on every page, for example.
The title: operator can be very useful, however, to catch forum posts that do not mention your query terms explicitly. Because
we split forum threads into individual mentions, a relevant forum post that does not use your one of your query terms may be
missed. Because forums frequently use the forum thread title as the page title, using the title: operator may be a way to get an
increased number of relevant forum mentions.
You cannot use the NEAR/x or NEAR/xf operators within the title: operator. Instead, it should be used on both sides of the
NEAR/x or NEAR/xf statement, like so:
title: chevrolet NEAR/5 title:(car OR vehicle))
NB: Be aware of using title: with twitter data. The title: operator will be ignored and the Query will match the search terms either
in the author name or in the Tweet itself.

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

The hashtags: Operator


The hashtags: Operator means that you can easily and accurately track specific hashtags on Twitter and Instagram. This
means easy campaign tracking and comparisons, hashtag competition tracking and brand monitoring.
The hashtags: operator is not case sensitive, and there is no need to include the actual hashtag ( # ). The hashtags: Operator is
written as the word "hashtags (in lowercase) followed by a colon, immediately followed by the query term like this:
hashtags:epicfail
As with other complex operators, you can search for multiple hashtags by implementing parenthesis () and the AND/OR
operators. If, for example, we wanted to find all instances of the hashtags; epicwin, epicfail and epic we would construct our
search as follows:
hashtags:(epicwin OR epicfail OR epic)
Like other field operators, the hashtags: operator will only work with the NEAR/x or NEAR/xf operators if used on both sides,
like so:
hashtags:oscars NEAR/5 hashtags:performance

The at_mentions: Operator


The at_mentions: Operator allows you to search for all Twitter instances where a specific Twitter handle is being @ mentioned.
This means you can specifically track tweets directed at a brand, allowing you to easily track customer service issues and
discussions with the brand. The operator wont pick up Mentions going out from the Brand, only ones being directed at it.
The at_mentions: operator is not case sensitive, and you dont need to include the @ symbol. Like other complex operators, the
at_mentions: operator is written in lowercase, followed by a colon and your query term, like this:
at_mentions:SimonCowell
As with other operators, you can search for mentions of multiple twitter handles by combining them with parenthesis and the
AND/OR operators. For example, to capture all of the mentions of multiple brand channels you would create the following
search:
at_mentions:(Nike OR nikestore OR NikeNYC)
If the Twitter handle is unambiguous, e.g. Nike, then writing Nike in a Query string without the at_mentions: operator would
still pick up all the tweets to the handle, but may also return people contacting irrelevant users that include the name in their
handle followed by a special character, for instance: @Nike_Fan, @Nike_Lover and @Nike-man, etc. The at_mentions:
component is not compatible with the wildcard or replacement operators ( * and ? respectively).
If you wish to pick up Tweets from the handle, user the author: operator. You may need to also use the site: operator to only
include Mentions from Twitter, like this:
author:nike AND site:twitter

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

The Replacement Operator ( ? )


The ? (question mark) wildcard can be used to match 1 alphanumeric character only (not none, or more than one). This is
commonly useful for matching alternate spellings of terms (e.g. US and UK spellings).
Term

Example matches

customi?e

customise, customize

reali?e

realise, realize

juli?

julie, julia

Note that the replacement operator cannot be used at the beginning of a term, but can be used anywhere in the middle or at
the end of a term. It is also not compatible with the raw: operator, and will not function within quotation marks. The term must
have at least 2 other characters to allow the usage of the replacement operator.
You can also use several replacements operators to pick up different potential spellings. For instance:
(Haagen NEAR/1f Da??)
This will search for: Haagen Dazs or Haagen Dass or Haagen Dazz etc.
In addition to this, you can also combine the replacement operator with the wildcard operator ( * ) like so:
Organi?ation*
This will search for: organization or organisation or organizations or organizational

The Wildcard Operator ( * )


The * (asterisk) wildcard can be used to match any number of characters at the end of or in the middle of a term (including 0
characters). Take the following examples:
Term

Example matches

house*

house, houses, houseflies, housewives

plan*

plan, planning, plane, plant, plantation

alumi*um

aluminum, aluminium, alumium

It may be apparent from the examples above that it is easy to match unintended terms if you are not careful with the wildcard
operator. Be careful when using it that you are not matching irrelevant terms.

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

Note that the replacement operator cannot be used at the beginning of a term, but can be used anywhere in the middle or at
the end of a term. It is also not compatible with the raw: operator, and is not supported for Asian languages. The term must
have at least 2 other characters to allow usage of the wildcard operator.
The operator will not function within quotation marks, so if youd like to use it in part of a phrase, a work around is to use the
NEAR/xf operator, like this:
(ice NEAR/0f cream*)
As using the wildcard operator can easily return unwanted mentions, its often a good idea to test how well the operator will
work with your term by excluding the stem of the term from the string and seeing what type of results get returned. You can
see an example of this below:
(iphone NEAR/15 break*) NOT break
For instance, the above Query would return mentions including "iphone" and "breakfast" but not "iphone" and "break"

https://support.brandwatch.com/hc/en-us/articles/204114708-Advanced-Query-Operators

10

Вам также может понравиться