All Products
Search
Document Center

Distinct

Last Updated: Sep 09, 2021

Overview

This topic describes the Distinct class and its methods.

Constructor (1)

This constructor requires no parameter.
Distinct()

Constructor (2)

This constructor requires you to specify a field to be used for distinct extraction.
Distinct(String key)

Parameter description

Parameter

Type

Description

key

String

The field to be used for distinct extraction. This field must be an attribute field.


setKey

Method definition

Specifies a field to be used for distinct extraction.
Distinct    setKey(String key)

Parameter description

Parameter

Type

Description

key

String

The field to be used for distinct extraction. This field must be an attribute field.


getKey

Method definition

Obtains the specified field to be used for distinct extraction.
String    getKey()

Return value

  • The specified field to be used for distinct extraction.


setDistCount

Method definition

Specifies the number of documents that are extracted each time.
Distinct    setDistCount(int distCount)

Parameter description

Parameter

Type

Description

distCount

int

The number of documents that are extracted each time. Default value: 1.


getDistCount

Method definition

Obtains the specified number of documents that are extracted each time.
int    getDistCount()

Return value

  • The specified number of documents that are extracted each time.


setDistTimes

Method definition

Specifies the number of times of extraction.
Distinct    setDistTimes(int distTimes)

Parameter description

Parameter

Type

Description

distTimes

int

The number of times of extraction. Default value: 1.


getDistTimes

Method definition

Obtains the specified number of times of extraction.
int    getDistTimes()

Return value

  • The specified number of times of extraction.


setReserved

Method definition

Specifies whether to retain the remaining documents after extraction.
Distinct    setReserved(boolean reserved)

Parameter description

Parameter

Type

Description

reserved

boolean

Specifies whether to retain the remaining documents after extraction. If this parameter is set to true, the remaining documents are retained. If this parameter is set to false, the remaining documents are discarded and the number of the discarded documents may be subtracted from the value of the totalHits parameter. Default value: true.


setUpdateTotalHit

Method definition

Specifies whether to subtract the number of discarded documents from the value of the totalHits parameter if the reserved parameter is set to false.
Distinct    setUpdateTotalHit(boolean updateTotalHit)

Parameter description

Parameter

Type

Description

updateTotalHit

boolean

Specifies whether to subtract the number of discarded documents from the value of the totalHits parameter if the reserved parameter is set to false. If this parameter is set to true, the number of discarded documents will be subtracted from the value of the totalHits parameter but the result may be inaccurate. If this parameter is set to false, the number of discarded documents will not be subtracted from the value of the totalHits parameter. Default value: false.


setDistFilter

Method definition

Specifies a filter condition to be used to select documents to be extracted.
Distinct    setDistFilter(String distFilter)

Parameter description

Parameter

Type

Description

distFilter

String

The filter condition to be used to select documents to be extracted. The documents that are filtered out will not be extracted, but will be sorted together with the first group of documents in the distinct extraction results. By default, all documents are selected for each distinct extraction.


getDistFilter

Method definition

Obtains the specified filter condition to be used to select documents to be extracted.
String    getDistFilter()

Return value

  • The specified filter condition to be used to select documents to be extracted.


setGrade

Method definition

Specifies a threshold for distinct extraction.
Distinct    setGrade(double grade)

Parameter description

Parameter

Type

Description

grade

double

The threshold for distinct extraction.


getGrade

Method definition

Obtains the specified threshold for distinct extraction.
String    getGrade()

Return value

  • The threshold for distinct extraction.