Support Menu

Interface IGroupByRequest

Interface IGroupByRequest

Describe a group by request to perform against the index.
See :



Optional allowedValues

allowedValues: string[]

This explicitly specifies a list of values for which Group By values should be generated.
Trailing wildcards can be used to include ranges of values.
eg : The array ["foo", "bar*"] would return Group By values for foo and any value starting with bar.

Optional computedFields

computedFields: IComputedFieldRequest[]

This specifies an array of computed fields that should be computed for each Group By value that is returned.
Computed fields are used to perform aggregate operations on other fields for all the matching items having a specific value in the Group By field in the results

Optional constantQueryOverride

constantQueryOverride: string

This specifies a constant query expression on which to compute the Group By operation.
By default, the constant part of the query expression being executed is used.
This feature is much like the normal queryOverride except that the index will keep the query expression in cache for faster queries. Do no put dynamic query expression in this parameter, as it will negatively impact the performance.


field: string

This specifies the field on which the Group By operation is performed. The Group By will return a Group By value for each distinct value of this field within the result set.

Optional generateAutomaticRanges

generateAutomaticRanges: boolean

By setting the parameter generateAutomaticRanges to true, the ranges will be calculated by the Coveo index.

Optional injectionDepth

injectionDepth: number

This specifies how deep the index will scan the results to identify missing Group By values.
If not specified, the default value is 1000.
When executing a Group By operation, the index uses various heuristics to list all the values that are appearing in the result set. In some corner cases, some values might be omitted (it's a classical trade-off of precision vs performance). Using injection means that the index will explicitly scan the field values of the top n results of the query, and ensure that the values present in those results are included. Using higher values for this parameter may impact query performance.

Optional maximumNumberOfValues

maximumNumberOfValues: number

This specifies the maximum number of values that the Group By operation will return.
If not specified, the default value is 10.

Optional queryOverride

queryOverride: string

This specifies a different query expression on which to compute the Group By operation.
By default, the query expression being executed is used.
This feature is typically used for performance reasons to retrieve Group By values on separate expressions while executing a normal query in a single operation.

Optional rangeValues

rangeValues: IRangeValue[]

This explicitly specifies a list of range values for which Group By values should be generated.

Optional sortCriteria

sortCriteria: string

This specifies how the Group By values should be sorted by the indexer. If not specified, the default value is Score.
Possible values are :
-- score : the score is computed from the number of occurrences as well as from the position in the result set where the items having this value are appearing. Using this criterion, an item with 100 occurrences might appear after one with only 10 occurrences if those occurrences tend to appear sooner in the ranked result set.
-- occurrences : Sort by number of occurrences, with values having the highest number appearing first.
-- alphaascending / alphadescending : Sort alphabetically on the field values.
-- computedfieldascending / computedfielddescending : Sort on the values of the first computed field for each Group By value.
-- chisquare : Sort based on the relative frequency of values in the result set compared to the frequency in the whole index. This means that a value that doesn't appear often in the index but does appear often in the result set will tend to appear higher in the list.
-- nosort : Do not sort the Group By values. The values will be returned in a random order.


  • IGroupByRequest