The Aggregate class

更新时间:
复制 MD 格式

Feature description

This document describes the methods that correspond to the parameters of the `aggregate` clause.

Constructor (1)

A constructor with parameters that specifies the group key when an object is created.
Aggregate(String groupkey)

Parameters

Parameter name

Type

Description

groupkey

String

Required. The name of the field for which to compute statistics. This must be an attribute field. Statistics can be computed for fields of the `int` and `literal` types.

Constructor (2)

Default constructor.
Aggregate()

Set the group_key parameter

Interface definition

Sets the group_key parameter.
Aggregate    setGroupKey(String groupkey)

Parameters

Parameter name

Type

Description

groupkey

String

Sets the group key.


Retrieve the group_key parameter value

Interface Definition

Gets the value of the group_key parameter.
String    getGroupKey()

Return value

  • The value of the `group_key` parameter.


Set the agg_fun parameter

Interface Definition

Sets the agg_fun parameter.
Aggregate    setAggFun(String aggfun)

Parameters

Parameter name

Type

Description

aggfun

String

Sets the `agg_fun` parameter. The value can be one of the following four system functions: `count()`, `sum(id)`, `max(id)`, or `min(id)`.


Obtain the aggfun parameter value

API Definition

Gets the value of the aggfun parameter.
String    getAggFun()

Return Value

  • The value of the `aggfun` parameter.


Configure the agg_filter parameter

Interface Definition

Sets the agg_filter parameter.
Aggregate    setAggFilter(String aggFilter)

Parameters

Parameter

Type

Description

aggFilter

String

Sets the `agg_filter` parameter.


Obtain the agg_filter parameter value

Interface definition

Gets the value of the agg_filter parameter.
String    getAggFilter()

Return value

  • The value of the `agg_filter` parameter.


Set the range parameter

Interface Definition

Sets the range parameter.
Aggregate    setRange(String range)

Parameters

Parameter name

Type

Description

range

String

Specifies segmented statistics for distribution analysis. Only one `range` parameter is supported. It defines a range from `number1` to `number2` and a segment for values greater than `number2`. Distribution statistics are not supported for `string` fields. For example, `range:0~10`.


Obtain the range parameter value

Interface Definition

Gets the value of the range parameter.
String    getRange()

Return value

  • The value of the `range` parameter.


Setting the agg_sampler_threshold parameter

API definition

Sets the agg_sampler_threshold parameter.
Aggregate    setAggSamplerThresHold(String aggSamplerThreHold)

Parameters

Parameter name

Type

Description

aggSamplerThreHold

String

Optional. The threshold for sampling statistics. Documents before this threshold are counted sequentially. Documents after this threshold are sampled.


Retrieve the agg_sampler_threshold parameter value

Interface definition

Gets the value of the agg_sampler_threshold parameter.
String    getAggSamplerThresHold()

Return value

  • The value of the `agg_sampler_threshold`.


Set the agg_sampler_step parameter

Interface Definition

Sets the agg_sampler_step parameter.
Aggregate    setAggSamplerStep(String aggSamplerStep)

Parameters

Parameter name

Type

Description

aggSamplerStep

String

Optional. The step size for sampling statistics. After the `agg_sampler_threshold` is reached, statistics are computed for one document in every `agg_sampler_step` documents. For `sum` and `count` statistics, the result from the sampled documents is multiplied by the step size. This estimated value is then added to the result from the documents before the threshold to get the final result.


Retrieve the agg_sampler_step parameter value

Interface definition

Gets the value of the agg_sampler_step parameter.
String    getAggSamplerStep()

Return value

  • The value of `agg_sampler_step`.


Set the max_group parameter

Interface Definition

Sets the max_group parameter.
Aggregate    setMaxGroup(String maxGrop)

Parameters

Parameter name

Type

Description

maxGrop

String

The maximum number of groups to return. The default value is 1000.


Obtain the max_group parameter value

Interface Definition

Gets the value of the max_group parameter.
String    getMaxGroup()

Return value

  • The value of the `max_group` parameter.