Product DocsMenu

Coveo Platform 7.0 >
User Help > More Advanced Search > Search Prefix and Operators

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 Coveo Platform recognizes Boolean, date, and relational operators as well as exact match and phrase match queries.

The following sections describe the syntax of prefixes and operators that you can use when you compose a search query:

Note: The Coveo Platform 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).

Exact Match Operators

The following exact match operators act on string content.

+ (plus sign)

The document must contain the exact term preceded by the + prefix, ignoring terms of the same family that are normally searched because of stemming query expansion (see About Stemming). The match is not case-sensitive.

Example: +develop
PutFinds documents containing develop and not those only containing terms of the same family such as development, developer, or developed.

The + prefix also forces the exact match for terms containing accented characters. This feature is useful with languages using accents such as French, Spanish, or Swedish.

Example: +déjà
Finds documents containing déjà, not those only containing accented character variants such as deja.

Note: You cannot use wildcard characters in combination with an exact match prefix.

# (number sign)

The deprecated # prefix produces the same behavior as the + prefix.

Example: #search
Finds documents containing search and not those containing terms of the same family such as searched, searches, or searching.

" " (double quotation marks)

The document must contain the exact phrase or term sequence comprised between the double quotation marks. The terms must be contiguous and in the exact order (see Searching a Phrase). The match is however not case-sensitive.

Example: "To be or not to be"
Finds documents containing this exact phrase.

Tip: Do not use double quotation marks for a single term. Rather use the + prefix.

. : / \ _ - ' (contiguity characters)

The document must contain the exact term sequence, with terms only separated by contiguity characters. The match is however not case-sensitive.

Example: The following queries:
Coveo.Enterprise.Search
Coveo-Enterprise/Search
Coveo\Enterprise:Search
find documents containing the term sequence and are equivalent to:
"Coveo Enterprise Search"

Boolean Operators

The following Boolean operators act on string content.

Note:

AND

The document must contain all terms (words, numbers, etc.) joined by AND. The term order is not important.

Note: By default, the AND operator is assumed between multiple terms.

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

OR

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

Example: Coveo OR Search
Finds documents containing Coveo or Search, or both.

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

NOT

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

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

Example: report NOT technical
Finds documents that do not contain technical but do contain report.

Notes:

  • CES 7.0.8388+ (June 2016) The thesaurus is activated when a query contains the NOT operator (see What Is the Thesaurus?).

    Examples:

    • When the word bob is set as a synonym of robert in the thesaurus, a query for arthur NOT robert becomes arthur NOT bob.

    • When the words robert, rob, bobby are set as synonyms of bob in the thesaurus, a query for arthur NOT bob becomes arthur NOT (bob OR robert OR rob OR bobby).

  • CES 7.0.8225– (March 2016) The NOT operator is incompatible with the thesaurus. No synonyms are searched for terms preceded by NOT.

    Example: When the word bob is set as a synonym of robert in the thesaurus, a query for arthur NOT robert remains arthur NOT robert.

NEAR

The document must contain the two terms (words, numbers, etc.) joined by the NEAR operator, by default no more than ten terms away from each other in a document (from 1 to 10 terms apart). This operator is useful to eliminate documents containing scattered occurrences of two queried terms when you rather search for documents containing the two terms close to each other.

You can also specify the maximum number of terms between two terms using the NEAR:n operator format.

Example: Coveo NEAR:10 Search
Finds documents containing Coveo and Search no more than ten terms apart.

Notes:

  • CES 7.0.8388+ (June 2016) The thesaurus is activated when a query contains the NEAR operator (see What Is the Thesaurus?).

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

  • CES 7.0.8225– (March 2016) The NEAR operator is incompatible with the thesaurus (see What Is the Thesaurus?). No synonyms are searched for terms succeeded by NEAR. Synonyms are only searched for terms preceded by NEAR when the thesaurus entry is set to replace original terms by a single synonym (see Adding Thesaurus Entries From the Administration Tool) .

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

  • 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: 

NOT [AND] OR

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

Example: You want to find a specific report for tablets and phones outside the USA. To narrow down the results, you know the document contains the words tablet, phone or smartphone and not the word sales. You type the following query:

tablet AND phone OR smartphone NOT USA

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

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

while you rather meant:

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

Tip: A best practice is to 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 (see Narrowing Results By Date). 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 document must have been created or modified between now and a required duration value.

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

today

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

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

yesterday

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

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

Mathematical Operators

= (includes)

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 document.

Applies to string, numeric and date content.

Example: @systitle=Coveo
Finds documents 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.

Example: @systitle=="Coveo Enterprise Search"
Finds documents 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.

Example: @systitle<>"Enterprise Search"
Finds documents 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.

Example: @syssize<50
Finds documents of 49 bytes or less.
@sysdate<today
Finds documents 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.

Example: @syssize>50
Finds documents of 51 bytes or more.
@sysdate>yesterday
Finds documents 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.

Example: @syssize<=50
Finds documents of 50 bytes or less.
@sysdate<=yesterday
Finds documents 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.

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

.. (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.

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

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

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

@sysdate=(2012/01/01..2012/01/31,2013/01/01..2013/01/31,2014/01/01..2014/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).

Example: @sysdate<yesterday+1d
Finds documents 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.

Example: @sysdate=now-1mo
Finds documents 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.

Example: 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.

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

Wildcard Operators

The following wildcard operators act on string content (see Using Wildcards in Queries)).

Notes:

  • You cannot use wildcard characters in combination with an exact match prefix.

  • By default, you must include at least two leading characters before the wildcard operator.

* (asterisks)

The document must contain the keyword completed by any number of any characters at the place of the * character.

Example: micro*
Finds documents containing words starting with micro such as Microsoft, microprocessor, or microphone.

? (question mark)

The document must contain the keyword completed by any character at the place of the ? character.

Example: gr?y
Finds documents containing words such as grey and gray.

Note: Your Coveo administrator can disable wildcard search or set a minimum number of leading characters (two by default) to prevent execution of computationally expensive wildcard queries (see Modifying or Using Advanced Index Parameters).

Miscellaneous Operators

- (minus, hyphen, or dash character)

The document 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.

Example: report -technical
Finds documents 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.

Examples:

  • @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"

( ) (parentheses grouping with operators)

The document 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.

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

People who viewed this topic also viewed