Query Parameters

Query parameters are search parameters being passed along with queries, that impact the returned results.

The available query parameters sorted in alphabetical order are:

Parameter Description

Default Value

Parameter Type Data Type
aq Short for advanced query expression. The aq is part of the query expression generated by code based on various rules, e.g., selecting a facet value will cause an expression to be added to the advanced query expression. Query String

Short for constant query expression. Similar to the aq, the cq holds expressions that are constant for all users of a search interface or widget. The results of evaluating those expressions are kept in a special index cache to avoid re-evaluating them on each query. You must be careful to not include dynamic parts in this expression, otherwise you risk filling up the cache with useless data and this might have a negative impact on performance.

Query String
dq Short for disjunction query expression. The dq is the disjunctive part of the query expression that is merged with the other expression parts using an OR Boolean operator. When specified, the final expression evaluated by the index ends up being (q aq cq) OR (dq). Query String

The DidYouMean component is responsible for displaying query corrections. If this component is in the page and the query returns no results but finds a possible query correction, whether the component either suggests the correction or automatically triggers a new query with the suggested term.

False Query Boolean

Whether to enable the special query syntax such as field references for the basic query expression (parameter q). When set to true, special characters such as [, ], {, }, -, and @ are interpreted as operator (see Coveo Cloud Query Syntax Reference). When set to false, special characters are interpreted as space.

True Query Boolean
excerptLength Specifies the length (in number of characters) of the excerpts generated by the indexer based on the keywords present in the query. The index includes the most interesting sentences (in the order they appear in the item) that fit in the specified number of characters. 200 Query Number

Specifies the 0-based index of the first result to return. The parameter allows you to retrieve a specific page of result items.

0 Query Number

Whether to treat the AND, NEAR, NOT, and OR keywords in the basic query expression as Coveo Cloud query syntax operators even if those keywords are in lowercase.

Setting this parameter to true has no effect unless you also set the enableQuerySyntax parameter to true (see enableQuerySyntax).

False Query Boolean

Short for large query expression. The lq is the contextual text part of the query which typically contains a case description, a long textual query, or any other form of text that can help refine a query. The Coveo Machine Learning service extracts relevant keywords from the lq value and adds those keywords to the basic query expression.

Query String

Specifies the number of results to return. Along with the firstResult parameter, numberOfResults allows you to retrieve a specific page of result items.

The maximum numberOfResults value depends on the index settings of your Coveo Cloud V2 organization. By default, a Coveo Cloud V2 index can return a maximum of 1000 items per query.

10 Query Number
partialMatch Whether to enable partial matching of the basic expression keywords. When the parameter is set to true and the basic expression contains at least IQuery.partialMatchKeywords, items containing only the number of keywords specified by IQuery.partialMatchThreshold also matches the query. When the parameter is set to false, items are required to contain all the keywords in order to match the query. False Query Boolean
partialMatchKeywords The minimum number of keywords needed to activate partial match. This specifies the minimum number of keywords needed for the partial match feature to activate. If the basic expression contains less than this number of keywords, no transformation is applied on the query.

Set the parameter to 3.

5 Query Number
partialMatchThreshold The threshold to use for matching items when partial match (partialMatch) is enabled. The parameter specifies the minimum number of query keywords that an item must contain when partial match is enabled. The parameter value can either be an absolute number or a percentage value based on the total number of keywords.

Set this parameter to 35%.

50% Query String
q Short for basic query expression. The q is typically the query expression entered by the user in a search box. Since this part of the query is expected to come from a user input, the parameter value is processed by the Did You Mean feature (see enableDidYouMean). Query / QuerySuggest String
questionMark Whether to enable question marks (?) with wildcards. The parameter enables the use of the question mark character (?) within wildcard expressions (you must set the wildcards parameter to true for this parameter to be effective). False Query Boolean
retrieveFirstSentences Whether the first sentences of the item should be included in the results. False Query Boolean

Specifies the sort criterion (or criteria) to use when sorting the query results. The possible criteria are:

  • Relevancy

    Use configured ranking weights as well as any specified ranking expressions to sort results.

  • DateAscending/DateDescending

    Use the @date field to sort results. This field typically contains the last modification date of an item in the index.

  • qre

    Sort using only the weights applied through ranking expressions. Similar to Relevancy, except that automatic weights based on keyword proximity and other criteria are not computed.

  • nosort

    Results are not sorted, meaning that the index will return results in an essentially random order.

  • @[field] ascending/@[field] descending

    Sort using the value of a custom, sortable field (replace [field] by the actual field name).

You can also specify a direction (ascending or descending).

@size descending

You can pass an array containing multiple criteria to the sort component (see Coveo Sort Component). If you specify multiple criteria, all criteria must have the same direction (either ascending or descending). You can only use the date and @[field] criteria when specifying multiple criteria. Criteria are evaluated in the order they are specified.

Relevancy Query String

Whether to enable wildcards (* and ?) in the basic expression keywords. When set to true, the Coveo Cloud Platform expands keywords containing wildcard characters to the possible matching keywords to broaden the query (see Using Wildcards in Queries).

You must also set the questionMark parameter to true to consider ? (see questionMark).

False Query Boolean