Expression Basics
Expression Basics
A Coveo query expression can be as simple as a single keyword, but can also include more complex expressions including fields, operators, prefixes, and more. For more information on the Coveo query syntax see Coveo Query Syntax Reference.
Keyword Expressions
Here are some facts and guidelines about keyword expressions (see also Basic Query Composition Facts and Guidelines):
-
Choose descriptive words.
-
Use the right number of terms.
-
Try synonyms (see Manage the thesaurus of your Coveo organization).
-
Same root words are searched (see About Stemming).
-
Each term is important.
-
Term order isn’t important.
-
Terms aren’t case sensitive.
-
Accentuated words are taken into account.
-
Misspelled words are corrected (see How Are Misspelled Words Handled?).
-
Punctuation is ignored.
-
Special characters may have special effects (see Using Special Characters in Queries).
-
Numbers are important.
Field Expressions
Akin to keyword expressions, data that describes other data is called metadata
, or sometimes, properties
or attributes
. In a Coveo implementation, metadata is referred to as fields
in the unified index. Field expressions are used throughout Coveo products, sometimes hidden in the code. For example, facets are simply built from a field expression: @[FieldName][RelationalOperator][FieldValue]
.
Some other field uses include:
-
For filtering - by applying a scope to a search tab (if using the JavaScript Search UI).
-
For formatting - by tailoring the template that displays information on a result.
-
For sorting - by providing less generic sorting options.
-
For relevancy - by providing optimization of search relevancy with ranking expressions.
To see which fields you may use and also the behavior inferred to each field, see Available System Fields.
Expression Operators
In either case of Keyword Expressions or Field Expressions, there’s a wide range of prefixes and operators that can scope the matching possibilities on the index (see Search Prefix and Operators). In some specific cases, there are even advanced field expressions which can be applied (see Advanced Field Queries).
Expression Completion or Suggestion
The Coveo search box can feature query completion to help reduce expression typing and suggest relevant expressions or search results that you can immediately select (see Using Query Completion). The typed string matches the beginning of words anywhere in the suggestion, therefore maximizing the probability to quickly find an appropriate suggestion. Within the JavaScript Search UI, query completion is provided by the means of the Omnibox Component and OmniboxResultList Component.
Another feature that provides help for effective queries is the Did You Mean feature (see How Are Misspelled Words Handled?). Within our JavaScript Search UI, misspelled expressions are managed by the DidYouMean Component.
In an Experience Cloud site, the Coveo-powered search interface only supports the Did You Mean feature when associated to the Standalone Search Box (see Adding the Coveo standalone search box).