Product DocsMenu

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

Using Wildcards in Queries

A wildcard character is a character that may be substituted for any of a defined subset of all possible characters. The asterisk character (*) may be substituted by zero or more word Unicode characters. The optional wildcard question mark character (?) may be substituted by any word character defined by the Unicode standard (see Using Special Characters in Queries).

Wildcards Behavior

Wildcard characters: * and ?

When you use a wildcard syntax in the search box, the Coveo Platform expands keywords containing wildcard characters to the possible matching keywords to broaden the query.

Examples:

micro*

Could match Microsoft and microprocessor.

te?t

Could return documents containing either the words text or test but could also documents containing te4t when this term exists in indexed documents.

Note: This works only when the question mark wildcard behavior is enabled (see Enabling the Question Mark Wildcard Behavior in a .NET Search Interface).

  • Matching a pattern

    Using wildcards can be useful when you do not remember the exact spelling for the name of a person, company, or product but you do remember part of it.

    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.

    Example:

    THI10*

    Find all product names starting with THI10.

  • Wildcard in a phrase search

    You can use wildcard characters within an exact match phrase, allowing some variability in a phrase search.

    Example:

    "fina* scandals 201?"

    Returns documents containing the following phrases: 

    • financial scandals 2012
    • final scandals 2010

    Note: This works only when the question mark wildcard behavior is enabled (see Enabling the Question Mark Wildcard Behavior in a .NET Search Interface).

  • Wildcard with the NEAR operator

    You can also use wildcard characters with the NEAR operator.

    Example:

    Fina* NEAR scandals

    Returns documents containing occurrences of words starting with fina that are within ten words from the word scandals.

Wildcard Constraints

Wildcard queries can significantly expand a query and consequently consume significantly 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. Thus, it is not supported to begin with a wildcard.

  • The query expansion is limited by default to the first 32 wildcard terms found alphabetically.

Note: Your Coveo administrator can customize the wildcard Number of candidates and Number of Leading Chars parameters to change these restrictions (see Modifying or Using Advanced Index Parameters).

Tip: Wildcard queries on the entire content of an index will 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. 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 (see What Are Field Queries and Free Text Queries?).

People who viewed this topic also viewed