Product DocsMenu

Coveo Platform 7.0 >
User Help > More Advanced Search > Using Special Characters in Queries

Using Special Characters in Queries

In a query, special (non-alphanumeric) characters either perform a particular action in specific contexts or are ignored, being interpreted as a blank space character.

Note: The Coveo Platform does not index special characters. Thus, you cannot search for a special character or for a term containing a special character, such as an email address containing the @ character. You can, however, search special characters with advanced field queries (see Advanced Field Queries).

The following table lists the syntax for special characters that you can use in a Coveo search box to perform a special action in specific contexts of a query.

Character Action Result behavior Query example
@ Indicates a field The term immediately following the at sign character is interpreted as a field. When the term is not a field, either no results are returned or a syntax error message appears (see Available Field Aliases). @sysfiletype=doc

Finds all .doc files.

+ Matches exact term When the plus character immediately precedes a term, only documents containing the exact term are returned. In other words, the + operator disables stemming for the term it precedes (see About Stemming).

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

+search

Finds documents containing search and not those containing terms of the same family like searched, searches, or searching.

Acts as the plus mathematical operator In a @sysdate field argument, when the + character appears between a date operator (now, today, or yesterday) and a duration value (in seconds [s], minutes [m], hours [h], days [d], months [mo], or years [y]), the duration value is added to the date operator. @sysdate<yesterday+1d

Finds documents created or modified yesterday or today.

# Matches exact term Like the plus character, when the number sign (also referred to as hash or pound sign) immediately precedes a term, only documents containing the exact term are returned (the term is not expanded by the stemming algorithm). 

Note: While the # sign still works, it is deprecated and has been replaced by the + character.

#search

Finds documents containing search and not those containing terms of the same family like searched, searches, or searching.

- Excludes term When the minus (hyphen or dash) character (preceded with a space) immediately precedes a term, documents containing the term (and same root terms) are excluded from the search results.

Note: The minus character is equivalent to using the NOT operator before a term.

roadmap -2010

Finds documents containing roadmap but not containing 2010.

Acts as the minus mathematical operator In a @sysdate field argument, when the - (hyphen) character appears between a date operator (now, today, or yesterday) and a duration value (in seconds [s], minutes [m], hours [h], days [d], months [mo], or years [y]), the duration value is subtracted from the date operator. @sysdate=now-1mo

Finds documents that were created or modified within the day exactly a month ago.

Acts as a contiguity character

When the - (hyphen) character appears between terms, the returned documents contain the term sequence in the specified order (see Contiguity Characters).

 

annual-roadmap-review

Returns documents contain the term sequence and is equivalent to: "annual roadmap review"

_

 

/

 

\

 

-

 

.

 

'

Act as contiguity characters When the underscore, slash, backslash, dash, dot (point or period), or single quotation mark character appears between terms, the returned documents contain the term sequence as well as the same root term sequence in the order specified.

Notes:

  • The Coveo Platform removes non-alphanumeric characters and replaces them with white spaces in the index. When you use a special character (e.g., a dash) between terms in your queries, you may thus have unexpected results if the indexed content contains other special characters (e.g., a slash) between the same queried terms.

  • Using the contiguity characters is equivalent to using quotation mark delimited term sequences like: "annual roadmap review".

annual_roadmap_review or a mix of contiguity characters
annual/roadmap\review

returns documents contain the term sequence ("annual roadmap review").

: Acts as a contiguity character When the colon character appears between terms, the returned documents contain the exact term sequence. annual:roadmap:review

Returns documents containing the exact term sequence.

Acts as an equal field operator When the colon character appears between a field and its argument, the colon is equivalent to an equal sign. With the colon character, you do not need to enter the at sign character (@) before the field. sysfiletype:doc

Returns all .doc documents.

= Acts as an equal field operator When the equal character appears between a field and its argument, the equal character acts as an equal sign.

Note: When several terms follow =, they do not need to be contiguous or in the exact order.

@systitle=(annual roadmap review)

Returns documents containing annual or roadmap or review in their title.

systitle=annual roadmap review

Returns documents containing annual in their title or roadmap or review anywhere in the document.

== Act as an exact match field operator When double-equal characters appear between a field and its argument, the equal acts as an exact, contiguous, and same order match operator for the argument terms appearing between quote marks. @systitle=="annual roadmap review"

Returns only documents with the title: annual roadmap review

<> Act as an exclude field operator When contiguous smaller than and greater than characters (<>) appear between a field and its argument, the characters act as an exclude operator for the argument term or terms appearing between quote marks. @systitle<>"roadmap review"

Returns documents that do not contain roadmap review in their title.

< Acts as an inferior mathematical field operator When the smaller than character appears between a field and its date or numerical argument, the character acts as an inferior operator. @syssize<50

Returns documents of 49 bytes or less.

@sysdate<today

Returns documents created or modified before today.

<= Act as an inferior or equal mathematical field operator When contiguous smaller than and equal characters appear between a field and its date or numerical argument, the characters act as an inferior or equal operator. @syssize<=50

Returns documents of 50 bytes or less.

@sysdate<=yesterday

Returns documents created or modified before today.

> Acts as a superior mathematical field operator When the greater than character appears between a field and its date or numerical argument, the character acts as a superior operator. @syssize>50

Returns documents of 51 bytes or more.

@sysdate>yesterday

Returns documents created or modified today.

>= Act as a superior or equal mathematical field operator When contiguous greater than and equal characters appear between a field and its date or numerical argument, the characters act as a superior or equal operator. @syssize>=50

Returns documents of 50 bytes or more.

@sysdate>=yesterday

Returns documents created or modified since the beginning of yesterday.

.. Act as an inclusive value range When two dots (points or periods) separate two field values, the dots act as an inclusive range operator. @syssize=1024..2048

Finds documents which size is greater or equal to 1024 bytes and smaller or equal to 2048 bytes.

" "
“ ”
« »
Match term sequence

When straight or curly quotation marks enclose terms, they act as a contiguous term sequence or phrase match.

Note: You can use wildcard characters in a phrase enclosed in quotation marks.

"annual roadmap review"

Returns documents containing the exact term sequence.

* Acts as a wildcard operator

When the asterisk character appears at the end, or in a term, it acts as a wildcard operator to specify a term completed by any number of any characters at the place of the asterisk character.

Important: By default, you must include at least two leading characters before the * [more]).

micro*

Returns documents containing terms starting with micro such as Microsoft, microphone, or microprocessor.

? Can optionally act as a wildcard operator

CES 7.0.4887+ (November 2012)
Coveo .NET Front-End version 12.0.57+ (November 2012)
The question mark character wildcard behavior is disabled by default, so the ? character is ignored when included in queries.

When enabled, the question mark character appearing at the end, or in a term, acts as a wildcard operator to specify a term completed by any character at the place of the question mark.

Note: Your Coveo administrator can enable the question mark wildcard behavior (see Enabling the Question Mark Wildcard Behavior in a .NET Search Interface).

gr?y

Returns documents containing terms such as grey or gray.

( ) Groups enclosed terms for Boolean operators When parentheses group terms with adjacent and included logical operators, they create a filter. Liz OR (project AND presentation)

Returns documents that contain either the first term or both of the other two terms.

( , ) Field operator When parentheses group space- or comma-separated terms in the argument of a field, the whole expression becomes the equivalent of using the OR operator between terms. @syslanguage=(english, french, spanish)

Is the same as:

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

[ ] Act as nested query delimiters

Square brackets are used as delimiters in a nested query. The nested query is a powerful yet complex Coveo query language feature that is typically used by developers.

In a search box, usage of brackets must respect the nested query syntax, with at least one level (two pairs of brackets). A single pair of brackets will return an Invalid syntax error.

filetype:artist [[@artistid] [[@albumid] songtitle:love] genre:rock]

The last nested query returns a list of artist from @artistid whose rock albums @albumid have at least one song with lovein its title.

"[query]" = returns documents that contain the term query.

[query] returns an Invalid syntax error.

Act as delimiters in regular expressions These brackets can be used in regular expressions when performing advanced field queries (see Regular Expression Match) . @username /= "[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}" matches user name field values that are in an email form.
$ 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.

$sort(criteria: 'datedescending')

Returns the input result set reordered following the specified criterion.

Indicates a Query Pipeline Language object

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.

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.

$language

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

$joinValues(values: $device)

Returns results for desktop, pc and windows to a Windows user.


Notes:

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

TM Represents the trademark symbol When the two letters tm appear at the end of a product name, they can represent the expanded form of the trademark symbol (™).

Note: The ™ symbol is a ligature that is expanded to tm in the index (see How Are Typographic Ligatures Handled?).

productnametm

Returns documents that contain either productnametm or productname™.

Other special characters Do nothing All other special characters, or specified characters appearing in other contexts in a query, are treated as a blank space and ignored, or they generate an error message.

Note: Examples of ignored special characters are: percent (%), question mark (?), exclamation point (!), semi-colon (;), ampersand (&), copyright (©), registered trademark (®), euro (€), pound (£), yen (¥), circumflex (^), left and right braces ({ }), and tilde (~).

annual&roadmap!review

Is equivalent to: annual roadmap review

People who viewed this topic also viewed