Create an Advanced Topic Query
Updated
With millions of conversations happening all over the web each day, it can be a long and tedious task trying to get more relevant mentions and tighten the scope of your query, but with the help of Advanced Topic Query, it can be at your fingertips.
In Social Listening, you have the option to create an advanced query that is not limited to ANY, ALL, or NONE formatting of query building. Advanced query builder can be used to form complex text queries which are not possible with a normal query builder.
What is an Advanced Topic Query?
Advanced topic query helps you to fetch relevant conversations by using advanced operators, nested parentheses, operators within operators, and much more.
By using advanced query you can pinpoint relevant information which is not possible with basic topic query.
It gives you the power to find the needle in a haystack.
Basic Topic Query v/s Advanced Topic Query
With more operators to use you can fetch conversations by language, geography, social media channel, volume, author, #listening, @account monitoring, user segment, and much more, it can give you access to more actionable insights.
In Basic Query, you can only use boolean operators like OR/ NOT/ AND/ along with NEAR. On the other hand, in Advanced Topic Query, it gives you access to use OR with/ inside AND, NOT (nested and within operator use cases), advanced operators, exact match operators etc.
Let's see the use cases where advanced query will help in getting more insightful mentions –
Use case #1: To search "pepsi" OR "drink" along with "cups".
Basic Query
Advancd Query
Use case #2: To get mentions of "pepsi" along with "coke" or "sprite" but not "miranda" with people having "follower count" between 100 to 1000 on "twitter".
Basic Query
Advanced Query
Not feasible in the basic Topic query
This is where we need the advanced Topic query.
How to create an advanced Topic query?
Click the New Tab icon. Under Sprinklr Insights, Click Topics within Listening.
On the Topics window, click Add Topic in the top right corner. Fill in the required fields and click Create.
In the Setup Query tab of Create New Topic window, select Advanced Query in the query section.
Type your query in the Advanced Query field with the required operators and syntax.
Click Save.
Tip: While using Instagram as a Listening Source, be sure that your query keywords include hashtags.
Which operators to use for building Topic queries?
Operators for Topic queries
In creation of advanced queries along with boolean operators OR/ AND/ NOT/ etc, Sprinklr also supports operator types –
Search Operators
Exact Match Operators
Operators for Getting Post Replies/Comments
Sprinklr provides its user edge by giving them power to use Keywords List inside advanced query along with Operators mentioned.
Create query using Topic query operators
Following are some most used operator examples and their results –
Operator | Example | Result |
hello | Search for the term "hello" | |
social sprinklr | Search for the phrases "social" and "sprinklr" Note: Using this will show preview but topic can not be saved as it will show error, Use "Social Sprinklr" or (Social AND/OR/ NOT/ NEAR Sprinklr) to eliminate error. | |
AND | social AND sprinklr | Search for "social" and "sprinklr" anywhere within the complete message, irrespective of keywords between them |
OR | social OR sprinklr | Search for "social" or "sprinklr" |
NOT | "social media" NOT "facebook" | Search for results that contain "social media" but not "facebook" |
~ | "social media"~10 | Search for "social" and "media" within 10 words of each other |
NEAR | social NEAR/10 media | Search for "social" and "media" within 10 words of each other Note: This operator can be used with keyword lists. |
ONEAR | social ONEAR/10 media | Search for "social" and "media" within 10 words of each other in an ordered way Note: This operator searches social ahead of media. |
title | title: ("social media") | Search for social media in the title of the message Note: It is mostly used for News, blogs, reviews and other sites. |
author | author: "social_media" | Fetches all the mentions from author name: social_media |
Some other operators which are supported by Sprinklr are –
Proximity: It is used to define proximity or distance between 2 keywords only, whereas, NEAR can be used to define proximity between two keywords as well as keyword lists.
Onear (Ordered Near): It sets the order in which the keywords will appear. For example, Keyword-List1 ONEAR/10 Keyword-List2 will ensure keywords from Keyword-List1 appear first and then Keyword-List2 keywords will follow within space of maximum 10.
Step by step guide to make advanced Topic query
Use case
To write query fetching mentions of ZARA –
(# listening is used for instagram listening)
Getting mention along with clothing or fashion related terms only –
Removing profanity from mention (use case specific) –
Removing profanity from mention (use case specific) –
As social media has lots of profane words you can also remove it by making a keyword list and negating it from query –
Filtering Mentions in English –
Applying source input as Twitter –
Getting mentions of those users which have followers between 100 to 1000 –
Advanced example showcasing use of Topic query operators and keyword list –
Best practices while using Advanced Query
Use of Parentheses
Parentheses are not necessary to enclose a search query but can be useful while grouping operations together for more complex queries.
For example, if you want to return results that mention Samsung or Apple phones, and also want to query content that mentions phones along with either Apple or Samsung, you could use parentheses around Apple and Samsung to group three keywords together, as shown below –
phone AND (Apple OR Samsung)
Use of parentheses within brackets, is further explained below with an example –
[(internet of things ~3) OR iot OR internetofthings) AND (robots OR robot OR #robot)] NOT [things]
Tip: You can also use parentheses within brackets to set off additional operations within the Advanced Query field. The end result should look similar to the result summary of a basic query, built using multiple operations within a single section.
As a part of the rest of the query, this will perform the following operations –
Search for posts that contain the phrase "internet of things" or "#internetofthings"
From within those results, keep any result that also says "robots" or "robot" or "#robot" within three words (a proximity search) of either "internet of things" or "iot" or "internetofthings".
Discard any results that just have the phrase "things" within.
Parentheses nested within brackets intend to set off different operations as isolated processes. In the previous example, if you build an Advanced Query that states [(internet of things OR iot OR internet of things) AND (robots OR robot OR #robot)] your query will return results that contain ANY of the first three terms and the second three terms.
However, if you build an Advanced Query that states [internet of things OR iot OR internet of things AND robots OR robot OR #robot], your query will return any result that contains the phrase "internet of things" or the word "iot" or the word "robot" or the hashtag #robot or specifically the phrase "internet of things" within the same message as the word "robots".
Note:
You cannot use a "NOT" statement with an "OR" statement.
Example:
( social OR NOT media ) ❌
( social NOT media ) ✅
(( social OR ( media NOT facebook )) ✅
Why?
Query should not contain "NOT" terms in "OR" with other terms, "NOT" clauses should be used in "AND" with other terms, using "NOT" in "OR" will bring too much data.
Use of Quotation marks
Quotation marks can be used for phrases in which you are looking for an exact match of those particular words in a specific order. Using parentheses or quotation marks for single-word queries is not mandatory.
Use straight quotation marks ( " " ) for outlining phrases within it. The use of curved quotation marks (“ ”) will not produce your desired results.
Parentheses are generally used to group keywords or phrases joined by one or more operators together, but with other keywords involved, parentheses and quotations would act differently. For example –
Version 1: "Phil Schiller" AND "Apple Marketing" will return results for content with the exact phrase Phil Schiller (or phil schiller) and the exact phrase Apple Marketing (or apple marketing).
Note: Here exact does not mean case sensitive as in the case of exactMessage Operator.
Example: exactMessage: ("Phil Schiller" AND "Apple Marketing"), which will fetch results for phrase Phil Schiller (not phil schiller) and the exact phrase Apple Marketing (not apple marketing).
Version 2: "Phil Schiller" AND (Apple OR Marketing) will return results for content with the phrase "Phil Schiller" (together) and at least one of the words, Apple or Marketing.
Handling for Broad & Ambiguous Keywords
It is very important to not use/reduce use of broad keywords in advanced queries. Broader keywords will fetch mentions that are unrelated to topic of interest, and eventually hinder dashboard/insights
For all keywords used in an advanced topic query, ensure they are directly related to the topic of interest.
In case keywords are broad but relevant to topic, they should be tied to some relevant keywords related to that topic, by using NEAR Operators
Example: Robot is an important keyword for Robot Company. However just using this keyword will fetch irrelevant keywords as it’s a broad keyword used for other entities as well (Robot Street, etc).
Instead of using just Robot keyword, we should use: Robot NEAR/4 (Technology OR “machine” OR # tech OR IOT OR “Internet of things” ….)
Note how keywords related to Robot are used with NEAR Operator. Related keywords could be related entities, industry keywords, parent company, country keywords, etc.
Frequently asked questions