Advanced Query Language & Search Shortcuts

Updated 5 months ago by Sofia Quintero

Query language

With query language, you can get the most useful results by telling us what you really need to see.
It helps you cut through some of the noisy data, to give you tailored search results.

1) Common Operations

  • and signifies AND operation
  • or signifies OR operation
  • - or not negates a single keyword
  • " wraps a number of keywords to signify a phrase for searching
  • * is a wildcard operator (see below) - used for partial matches
  • ( and ) signify precedence

Examples

apples and oranges and -pears
          

(give me all documents mentioning "apples" and "oranges" but not "pears")

(apples or oranges)  -pears (apples or oranges)  not pears
          

(give me all documents which have words "apples", "oranges" or don't contain "pears")

(apples or oranges) and -pears
          

(give me all documents which have words "apples" or "oranges" but they don't contain word "pears")

Query like this:

"apples and oranges" and -pears
          

will find only documents with phrase "apples and oranges" but not mentioning "pears".

-"apples and oranges" and pears
          

will find documents which don't include phrase "apples and oranges" and have the word "pears"

Quotes matter! When searching for phrases always make sure to use double quotes (") - single quotes (') are simply ignored, meaning:

"trial account"

is not the same as

'trial account'

To be more specific: 'trial account' is the same as trial or account. Similarly "trial account" is the same as trial and account.
pric*
          

gives us all documents which have words like price, pricing, priced etc.

Default operator OR is the default operator, so query like this:

apples oranges

expands to

apples or oranges

This is important because when combined with - operator (negation) the results will be quite different:

apples -oranges

which means "apples or not oranges", where you probably mean:

apples and -oranges

which means "apples and not oranges"

2) Filter Terms

No spaces please When using shortcuts, always make sure that : is not followed by a space.

source:intercom

Is correct, but

source: intercom

is not. The search might work but will be same as searching for source: or intercom

User property filters

User properties can come in different types - numbers, dates and text. Each uses different syntax:

user:email:test@example.com - find feedback from user with email test@example.com

user:company.number_of_users:[10 to 100] - find feedback from all users in companies with number of users between 10 and 100

user:"signed up":[now-7d to now] - find all feedback from users who signed up in last 7 days.

user:email:*@example* - will find all documents from users who's email address has example domain ("terry@example.com" "clyde@example.org" or "mary@example.it")

Wildcards

* operator means 'match anything' - it can be used for:

  • partial matches in a word:

    • appl* - will match all words starting with appl
    • *appl* - will match all words with appl inside
  • presence of a term:

    • tag:ba* - will find documents with any tag starting with "ba"
    • user:number_of_bikes:* - will find all documents for which users have any number of bikes

Combining queries and useful shortcuts

Sometimes you want to find all unprocessed feedback - recently added documents with no tags or themes. This query will help:

added:[now-7d to now] and not has:tags and not has:themes
          

which finds all documents which:

  • have been added in last 7 days
  • have no tags
  • have no themes

Queries can also support variants:

(source:intercom and added:[now-30d to now]) or (source:zendesk and created:[now-7d to now])
          

Will find either:

  • documents from Intercom added in last 30 days
  • or documents from Zendesk created last week

Query language is fully supported in Rules and Highlight's search.


How Did We Do?