Search Prefixes and Operators

You can use search prefixes and operators to refine a search by specifying more precisely what terms (words, numbers, expressions…) you are looking for. The following sections describe the syntax of prefixes and operators that you can use when you build a search query.

Coveo Cloud does not index special characters other than letters and numbers. This means that you cannot search for a special character or for an expression containing a special character such as an email address that contains the @ character. You can however search special characters with advanced field queries (see Advanced Field Queries).

If you have querying issues, see Troubleshooting Querying Issues for troubleshooting guidelines.

Exact Match Operators

Exact match operators allow you to search for a specific term or phrase (see Searching for an Exact Term and Searching for a Phrase).

Boolean Operators

The following Boolean operators act on string content.

  • AND

    The item must contain all terms (words, numbers, etc.) joined by AND. The term order is irrelevant.

    By default, the AND operator is implicitly assumed between multiple terms separated by a space.

    Coveo AND Search AND Help
    Finds items containing all three terms and is equivalent to: Coveo Search Help

  • OR

    The item must contain at least one of the terms (words, numbers, etc.) joined by OR.

    Coveo OR Search
    Finds items containing Coveo or Search, or both.

    You can also use comma separated terms between parentheses to achieve the same results (see Miscellaneous Operators).

  • NOT

    The item must not contain the term (words, numbers, etc.) preceded by NOT.

    The - prefix has the same effect (see Miscellaneous Operators).

    report NOT technical
    Finds items that do not contain technical but do contain report.

  • NEAR

    The item must contain the two terms (words, numbers, etc.) joined by the NEAR operator, and there should not be more than a certain number of terms between these terms in the item. This operator is useful to eliminate items containing scattered occurrences of two queried terms when you rather search for items containing the two terms close to each other.

    You can specify the maximum number of terms to allow between your two terms using the NEAR:n operator format. If you use NEAR only, i.e., you do not specify a value for n, the default value is 10.

    • Coveo NEAR:5 Search
      Finds items in which Coveo and Search are no more than five terms apart.
    • Coveo NEAR Search
      Finds items in which Coveo and Search are no more than ten terms apart.
    • Boolean operators are always recognized as operators when they are typed in uppercase letters.
    • Boolean operators are interpreted as operators regardless of their casing when entered in the search box.
    • The thesaurus is activated when a query contains the NEAR operator .

      When the word phone is set as a synonym of smartphone in the thesaurus, a query for phone NEAR sales becomes smartphone NEAR sales.

    • Near:[value] is not interpreted as a field expression, meaning that searching for near: new york returns results containing near, new, and york.

Priority of Boolean Operators

When you use more than one Boolean operator in a query without parenthesis, the query is interpreted with the following Boolean operator priority:

NEAR NOT [AND] OR

where [AND] is an implicit AND when no operator is entered between two keywords.

You want to find a specific report for the tablet and phone sales outside the USA. To narrow down the results, you know the item contains the words tablet, phone or smartphone within a few words from the word sales. You type the following query:

tablet AND phone OR smartphone NEAR sales NOT USA

Because of the Boolean operator priority rule, the query is interpreted as:

(tablet AND phone) OR ((smartphone NEAR sales) (NOT USA))

while you rather meant:

((tablet AND (phone OR smartphone)) NEAR sales) (NOT USA)

Use parenthesis because it is a more explicit method to compose a query with multiple Boolean operators that translate to the expected behavior.

Date/Time Operators

The following date operators act on date and time values. You specify a duration value using the time units suffixes: seconds (s), minutes (m), hours (h), days (d), months (mo) or years (y).

  • now

    The item must have been created or modified between now and a required duration value.

    @sysdate<=now-12h Finds items created or modified at least 12 hours ago.

  • today

    The item must have been created or modified today or between today and an optional duration number of days.

    @sysdate=today Finds items created or modified today. @sysdate>=today-30d
    Finds items created or modified within the last month.

  • yesterday

    The item must have been created or modified yesterday or between yesterday and an optional number of days.

    @sysdate=yesterday
    Finds items created or modified yesterday.
    @sysdate>yesterday-6d
    Finds items created or modified in the previous seven days.

Comparison Operators

  • = (contains)

    The field must contain the terms (words, numbers, etc.) following =. When several terms follow =, they do not need to be found contiguous or in the exact order, in the item.

    Applies to string, numeric and date content.

    @systitle=Coveo
    Finds items containing Coveo in their titles.

  • == (is exactly)

    The field must contain the exact terms (words, numbers, etc.) as they appear following ==, in the exact and contiguous order. No other term can be present in the field.

    Applies to string, numeric and date content.

    @systitle=="Coveo Enterprise Search"
    Finds items with this exact title only: Coveo Enterprise Search

  • <> (excludes)

    The field must not contain the terms (words, numbers, etc.) following the <> operator.

    Applies to string, numeric and date content.

    @systitle<>"Enterprise Search"

    Finds items that do not contain Enterprise Search in their title.

  • < (smaller than)

    The value contained in the field must be inferior to the value entered after <. For dates, this means older than, or before. A file size is entered in bytes.

    Applies to numeric and date content.

    @syssize<50
    Finds items of 49 bytes or less.
    @sysdate<today
    Finds items created or modified before today.

  • > (greater than)

    The value contained in the field must be superior to the value entered after >. For dates, this means more recent than, or after. File size is entered in bytes.

    Applies to numeric and date content.

    @syssize>50
    Finds items of 51 bytes or more.
    @sysdate>yesterday
    Finds items created or modified today.

  • <= (smaller than or equal to)

    The value contained in the field must be inferior or equal to the value entered after <=. For dates, this means up to the time of reference. File size is entered in bytes.

    Applies to numeric and date content.

    @syssize<=50
    Finds items of 50 bytes or less.
    @sysdate<=yesterday
    Finds items created or modified before today.

  • >= (greater than or equal to)

    The value contained in the field must be superior or equal to the value entered after >=. For dates, this means at the time of reference and after. File size is entered in bytes.

    Applies to numeric and date content.

    @syssize>=50
    Finds items of 50 bytes or more.
    @sysdate>=yesterday
    Finds items modified or created yesterday or today.

Mathematical Operators

  • .. (value range)

    The value contained in the field must be in the inclusive range specified by two values separated by two dots (double points or periods). File size is entered in bytes.

    Applies to numeric and date content.

    @syssize=1024..2048
    Finds items of at least 1024 bytes and not more than 2048 bytes in size.

    You can specify a list of numeric ranges using the following format: @numericfield=(a..b,c..d,e..f).

    You want to look for items that were created during January of year 2014, 2013, and 2012. You can use the following multiple range field query:

    @sysdate=(2015/01/01..2015/01/31,2016/01/01..2016/01/31,2017/01/01..2017/01/31)

  • + (plus)

    The duration value in seconds (s), minutes (m), hours (h), days (d), months (mo) or years (y), is added to the date operator (now, today, or yesterday).

    @sysdate<yesterday+1d Finds items that were created or modified yesterday or today.

  • - (minus)

    The duration value in seconds (s), minutes (m), hours (h), days (d), months (mo) or years (y), is subtracted from the date operator (now, today, or yesterday).

    Applies to date content.

    @sysdate=now-1mo
    Finds items that were created or modified during one day exactly one month ago.

Email Operators

The following email operators act on string content. These prefixes return results only in search interfaces searching email messages.

  • from

    The email message must be received from anyone whose name or address contains the specified term.

    from:Liz
    Finds emails received from anyone whose name or address contains Liz.
    from:"Liz Smith"
    Finds emails received from Liz Smith.

  • to

    The email message must be sent to anyone whose name or address contains the specified term.

    to:Liz
    Finds emails sent to anyone whose name or address contains Liz.
    to:"Liz Smith"
    Finds emails sent to Liz Smith.

Wildcard Operators

Wilcard operators allow you to broaden search to match several variants of a word or a phrase (see Using Wildcards in Queries).

Miscellaneous Operators

  • - (minus, hyphen, or dash character)

    The item must not contain the exact term preceded by the - prefix and a space. The exclude - prefix is equivalent as using NOT before a term (see Boolean Operators).

    Applies to string content.

    report -technical

    Finds items that contain report but do not contain technical.

  • @field=( , ) (parentheses and comma with field queries)

    The field must contain at least one of the values isolated by parentheses and separated by commas.

    This is equivalent to using the OR operator between terms (see Boolean Operators).

    Applies to string and date content.

    • @syslanguage=(english, french, spanish)

      Is the same as:

      @syslanguage=english OR @syslanguage=french OR @syslanguage=spanish

    • @title=("one exact phrase","another exacter phrase")

      Is the same as:

      @title="one exact phrase" OR @title="another exacter phrase"

  • $ (dollar character)

    The dollar character invokes a query extension. The term immediately following the dollar sign character is interpreted as a query extension name (see Query Extension Language). The invoked query extension is applied to the search results.

    Applies to string content.

    Example: report $sort(criteria: 'datedescending')
    Finds items that contain report, and sorts them by date in descending order.

    The term immediately following the dollar sign character is interpreted as a Query Pipeline Language (QPL) object (see QPL Objects). For some QPL objects, the search API replaces the $ expression by the corresponding query parameter value, and then sends it to the index. This returns results that contain the query parameter value.

    $language
    Returns results for en when language query parameter value is en.

    However, QPL objects such as device, os and browser do not have a matching query parameter and may be associated to multiple user-agent values for a single Coveo Cloud user. Using a $joinValues expression makes one string out of the multiple values returned by such QPL objects.

    $joinValues(values: $device)
    Returns results for desktop, pc and windows to a Windows user.

    • Query extensions and QPL objects are typically used by advanced administrators and developers.

    • If the character string following the dollar sign is not a valid query extension name or a valid QPL object name, the query returns the following error message: “Something went wrong. If the problem persists contact the administrator.”

  • ( ) (parentheses grouping with operators)

    The item must contain the keywords and respect the filter built using parentheses to group keywords with operators. Parenthesis are useful to ensure the desired results when using multiple Boolean operators in a query (see Priority of Boolean Operators).

    Applies to string content.

    Liz (project NEAR:5 presentation)
    Finds items containing the three keywords but where keywords project and presentation are no more than five terms apart.