Using Wildcards in Queries
Coveo supports wildcard characters
enableWildcards option) independently from the Coveo query syntax (
enableQuerySyntax option) in the
Querybox component (see QueryBox Component and Coveo Component Querybox).
See also how you can leverage wildcard characters in advanced field queries (see Advanced Field Queries). If you have querying issues, see Troubleshooting Querying Issues for troubleshooting guidelines.
Using the ? Wildcard
You can use wildcard characters within to allow some variability in your search. It can be useful when you are unsure about the exact spelling for the name of a person, company, or product. See also Using Special Characters in Queries.
Could return items containing either gray or grey.
Could return items containing either text or test, but could also return items containing te4t when this term exists in indexed items.
Using the * Wildcard
Using wildcard characters can be useful when you want to match all variants of a pattern. You type the fixed part of the pattern and use a wildcard character to expand to the variants. In place of the wildcard, the variants can contain any number of any characters. See also Using Special Characters in Queries.
Could match Microsoft, microprocessor, microwave, micron, etc.
Find all product names starting with THI10.
Using a Wildcard in an Exact Phrase
You can also one or both wildcards in conjunction with quotation marks to find variants of a phrase (see Searching for a Phrase).
"fina* scandals 201?"
Returns items containing the following phrases :
financial scandals 2012
final scandals 2010
Using a Wildcard with the NEAR Operator
You can also use wildcard characters with the NEAR operator.
fina* NEAR:10 scandals
Returns items containing occurrences of words starting with fina that are within ten words from the word scandals, such as in the following phrases:
… poor financial decisions led to these scandals…
… number of financial scandals…
… final decision. Due to the multiple scandals…
You cannot use wildcard characters in combination with an exact match prefix (see Searching for an Exact Term).
Moreover, wildcard queries can significantly expand a query and consequently consume more server resources than a typical query. To prevent this:
By default, at least two leading characters must precede the wildcard to restrict the number of wildcard terms candidates (see Using Wildcards in Queries). Thus, a query cannot begin with a wildcard.
The query expansion is limited by default to the first 32 wildcard terms found alphabetically. Increasing the maximum number of candidates can lead to performance issues, as more terms will have to be loaded for your wildcard expression.
A given wildcard expression may match a number of candidate items exceeding the maximum allowed by the index. In such a case, the Search API responds with a
Wildcard queries on the entire content of an index always take longer to return results. For content where wildcards are appropriate, consider isolating the data in a field, and using the field for the wildcard search (see Advanced Field Queries). When searching in a field, the number of possibilities is smaller, so using the same wildcard expression may return more or even all possible results.