Help Center

Account Settings > Topics > Creating a Keyword Query

Last Updated: Nov 15, 2016 05:07AM EST

In this article you can read more about:

Searches and filters are used in CX Social:

  • When setting up a topic to define which mentions are tracked.
  • When filtering within your tracked data using the filter field (upper right corner).

In this article, we focus on defining a keyword search for a topic. However, most of it also applies to filtering within CX Social data, setting up a smart tag or automation rule, etc. For our purposes, we will work with the example Telenet, a Belgian telecom operator.

How to Build a Keyword Query

Step 1: Opening the Keyword Search Settings

Go to Settings > Topics and create or edit the keyword search of a topic by clicking 'Add' next to 'Keyword Search'.

Step 2: Searching for Mentions Containing Either Telenet or "Tele Net"

Please note: In order to be able to perform a keyword search, you will need at least one 'all' (text) condition. If you don't have this, you won't be able to create a keyword search. 

Let's say people often talk about this brand as "tele net", in two words. This means we have to search for two keywords: telenet or "tele net". Let's insert these keywords.
  • Select the condition 'all' in the grey drop down. Then set the green drop down to 'contains any', ensuring that mentions containing any of the specified words are a match. (Note that using 'contains all' would mean both words have to be present in order for the mention to come into CX Social. 'Contains not' would exclude mentions containing any of the keyword(s)).
  • Add the words telenet and "tele net" using quotation marks for the latter (this means you want to monitor that exact combination of words):
In the keyword search pop-up, you can choose between either the query builder view: here we will show you all available keyword conditions ('all', 'country', 'language', 'sentiment'...) and the positive ('contains all', 'contains any', 'is') or negative ('contains not', 'is not') conditions. 

But if you are used to using code to setup your keyword query, you can also work in the 'advanced' view. 
Here you will need to user brackets, AND, OR and NOT to structure your boolean search query. But if you're not really used to this kind of code, it's safer to work in the query builder mode. 

Step 3: Add other extra conditions (if wanted). 

Given we are only interested in mentions from Belgium, we can filter on country.
  • Click the + sign to the right of the existing condition to add a new condition below it.
  • Set the new condition respectively as 'country', 'is', and 'Belgium', like this:


Now, CX Social doesn't know location for all the mentions it tracks. (More information on that in the support article on location.)

This means we would miss out on the mentions that don't have a location but originate from Belgium. That's why it's always useful to also include mentions without a specific location (Country: unknown) in the languages from the country you're interested in (in this case the language is Dutch). Here's how:
  • Click the symbol on the very right of the 'country' condition (the one after the +). 
  • A new condition for 'all' appears.
  • On the new condition 'all', click the symbol on the right again.
  • Again, a new condition appears. Now fill in the newly created conditions like this:
    - Country is unknown
    - Language is Dutch
  • You've now created a nested query with an 'or' in front of it. This means that one of the two conditions that follow has to be fulfilled:
    - either the mention comes from Belgium
    - OR the mention is in Dutch AND the country is unknown

This will make your search broader by including both mentions from Belgium and mentions that have no specific location but are written in Dutch. You can do this with whatever country and language(s) you need.

Step 4: Watch Preview and Save Query

Before a newly created/edited query can be saved, CX Social asks you to click 'Preview' to ensure that it results in relevant mentions. To save your query:
  • Click the preview button at the bottom of the dialog. A list of mentions matching the search appears on the right. If nothing appears, no problem, we're not always able to show you exemplary mentions.
  • Click the add/save button. 

What's the logic behind the Query Builder?

Each grey bar shown is a condition consisting of:

  • The property of a mention (e.g. 'all', 'country', or 'language').
  • What the condition looks like (e.g. contains all, contains any, contains not).
  • The specific value the condition is about: in the example on top 'Telenet or "tele net"' (all), 'Belgium' (country), etc.

The conditions that appear on top of each other all have to be fulfilled, and this means all three have to be fulfilled. In the case of Telenet, there are 2 main conditions:
  1. The mention has to contain Telenet or "tele net".
  2. The mention has to come from a specific location. Remember, this is a 'nested' condition which means it's introduced by 'OR'. This means that one of the two subconditions that follow have to be fulfilled:
  • either the mention comes from Belgium
  • or (and then again a nested condition) the mention is in Dutch because the country is unknown

The following actions can be performed on conditions:

  • Click the + icon on the right to add a new condition.

  • Click the - icon to remove a condition.
  • Click the 'group and indent' icon  (the icon next to +) to make a condition 'nested'. A nested condition can be introduced by 'OR' or 'AND' which you can change yourself by clicking on the arrow next to 'OR' or 'AND'. 
  • Condition bars can be dragged to a different position by dragging them using the "ribbed" handle on the left side.


Important Notes  

Here are some things to keep in mind when creating large, complex and negative searches within one keyword search:
  • Punctuation symbols.
    Punctuation symbols: ",", "?", "!", "\"", "<", ">", "%", "*", "-", "+", "\\", "/" are treated as whitespace. Thus searching for "word/something" also yields results containing "word something" (and vice versa). 

    Important note: some characters such as / and ^ may have a special meaning and therefore need to be quoted “ ” when searched for in the filter field.  
  • Dots "." and colons ";"
    Dots and colons are treated as whitespace if they are preceded or followed by whitespace (including the beginning and the end of a string) or punctuation symbols (including dots and colons) but not otherwise.

  • Tokens starting with “^”, “@“ or “#"
    Tokens starting with ^, @ or # and tokens containing single quotes are treated specially = always use the quotations.
  • Curly single quotes
    Curly single quotes ("’", "`", "′" and "‘") are treated as if they are equal to the normal single quote (" ' ")
  • Emoji’s and Emoticons
    Emoji’s and emotions are not supported in keyword searches.
  • Searches can be negative to exclude keywords.
    Use 'is not' or 'contains not' in the middle dropdown to exclude keywords, countries, languages, etc.
  • Keywords are case insensitive
    Searching for the keyword: 'Telenet' and ‘TELENET’ is the same.
  • Anything that’s separated by whitespace can be searched for.
    Searching for “foo" "bar” for example will give results for mentions containing “foo” and “bar” although not necessarily next to each other or even in that order (unless both words are put in between double quotes together “foo bar” -> exact match searches)
  • Single characters are supported.
    Searching for “8” = will return results when the number 8 is being mentioned in the mention or the post.
  • Underscores
    Underscores are treated specially, except in Twitter handles and Hashtags they are treated as whitespace but the original string is also kept.
    • Only up to 5 underscores are supported 0_1_2_3_4_5_6
  • Put words beween quotation marks (") if you only want to monitor that exact combination of words, e.g. "Amnesty International" or "tele net". 
  • Proximity: Proximity means setting a condition that different words have to appear within "x" words from each other in the text. You can do this for the distance between individual words, but you can't do this for word groups. You can't say that "amnesty international" and "world peace" have to appear within 20 words of each other. What you can say: I want amnesty and international to appear within 20 words from each other. Like this:

    "amnesty international"~20

    Be certain to attach ~20 immediately after the words that are placed within the quotation marks (without a space, like in the example shown above).
  • Keyword complexity: There is a maximum limit to how many keywords you can track in one query/topic. This is related to the number of 'OR' conditions of your text though combinations of different 'OR' conditions can make the complexity increase rapidly. See the article on keyword complexity for a more detailed explanation. 

    Note that when a keyword query is not allowed because of its complexity, you can always split it up in two different topics to ensure you are monitoring every keyword you wish.
  • Underlying the advanced query builder is a 'raw' query, which you can view and edit in Expert Mode. Please refer to this support article for more info.
  • When you search for e.g. "L'épargne pension", this wil return the same results as searching on "épargne pension". This is because the algoritm we use doesn't index 'words' of only 1 character (like "L' "). So if "L'épargne pension" is in your keyword search, we will in fact look for mentions that contain the words "épargne" + "pension". 

These are the properties conditions can have:
  1. All: Here you can enter the keywords you want to monitor. When using the 'All' property, we search our sources entirely for this Keyword. This means not just the text itself, but for instance also the title, url's that were mentioned, username, ... What parts are being searched exactly, depends on the source. 
  2. Author: If you only want to include mentions by certain authors (their exact user names on social media). If you e.g. want to include mentions coming from a certain Twitter author, you have to fill in his Twitter handle without the '@' (so e.g. if you want to include the author @christinehuts, just fill in author is christinehuts). hash
  3. Author ID: Works like 'author' but based on the user's id rather than the name. note: this does not work for public facebook posts, because for those, user ID is not included in the post because of privacy restrictions. You can find more info about this here.
  4. Category: If you only want to monitor a specific source (blogs, forums, news, etc.).
  5. Content: When using this condition, you specify that the keywords should only be mentioned in the 'content' part of a source. What is included in this content part, depends on the source again. For instance for Twitter, 'Content' is merely the tweet itself, so not the Twitter Handle. 
  6. Country: The country from which the mentions have originated.
  7. Full Name: If you only want to include mentions by certain people (their full name on social media). For example, author is Folke and full name is "Folke Lemaitre".
  8. Language: The language in which the mentions have to be.
  9. Provider: This filter is used mostly by the CX Social Team. It allows us to search mentions coming from a specific Data Provider. 
  10. Source Domain: The website the mentions have to come from. It's very important to always insert websites in two ways like, and, just to be sure you don't miss out on any mention.
  11. Title: The keywords you want to monitor, but only when they appear in the title. 

Contact Us
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found