Google Cloud Discovery Engine V1 Client - Class FacetKey (1.0.0-RC1)

Reference documentation and code samples for the Google Cloud Discovery Engine V1 Client class FacetKey.

Specifies how a facet is computed.

Generated from protobuf message google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKey

Namespace

Google \ Cloud \ DiscoveryEngine \ V1 \ SearchRequest \ FacetSpec

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ key string

Required. Supported textual and numerical facet keys in Document object, over which the facet values are computed. Facet key is case-sensitive.

↳ intervals array<Google\Cloud\DiscoveryEngine\V1\Interval>

Set only if values should be bucketed into intervals. Must be set for facets with numerical values. Must not be set for facet with text values. Maximum number of intervals is 30.

↳ restricted_values array

Only get facet for the given restricted values. Only supported on textual fields. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "restricted_values" to "Action > 2022", the "category" facet only contains "Action > 2022". Only supported on textual fields. Maximum is 10.

↳ prefixes array

Only get facet values that start with the given string prefix. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the "category" facet only contains "Action > 2022" and "Action > 2021". Only supported on textual fields. Maximum is 10.

↳ contains array

Only get facet values that contain the given strings. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". Only supported on textual fields. Maximum is 10.

↳ case_insensitive bool

True to make facet keys case insensitive when getting faceting values with prefixes or contains; false otherwise.

↳ order_by string

The order in which documents are returned. Allowed values are: * "count desc", which means order by SearchResponse.Facet.values.count descending. * "value desc", which means order by SearchResponse.Facet.values.value descending. Only applies to textual facets. If not set, textual values are sorted in natural order; numerical intervals are sorted in the order given by FacetSpec.FacetKey.intervals.

getKey

Required. Supported textual and numerical facet keys in Document object, over which the facet values are computed. Facet key is case-sensitive.

Returns
Type Description
string

setKey

Required. Supported textual and numerical facet keys in Document object, over which the facet values are computed. Facet key is case-sensitive.

Parameter
Name Description
var string
Returns
Type Description
$this

getIntervals

Set only if values should be bucketed into intervals. Must be set for facets with numerical values. Must not be set for facet with text values. Maximum number of intervals is 30.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setIntervals

Set only if values should be bucketed into intervals. Must be set for facets with numerical values. Must not be set for facet with text values. Maximum number of intervals is 30.

Parameter
Name Description
var array<Google\Cloud\DiscoveryEngine\V1\Interval>
Returns
Type Description
$this

getRestrictedValues

Only get facet for the given restricted values. Only supported on textual fields. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "restricted_values" to "Action > 2022", the "category" facet only contains "Action > 2022". Only supported on textual fields. Maximum is 10.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setRestrictedValues

Only get facet for the given restricted values. Only supported on textual fields. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "restricted_values" to "Action > 2022", the "category" facet only contains "Action > 2022". Only supported on textual fields. Maximum is 10.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getPrefixes

Only get facet values that start with the given string prefix. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the "category" facet only contains "Action > 2022" and "Action > 2021".

Only supported on textual fields. Maximum is 10.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setPrefixes

Only get facet values that start with the given string prefix. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the "category" facet only contains "Action > 2022" and "Action > 2021".

Only supported on textual fields. Maximum is 10.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getContains

Only get facet values that contain the given strings. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".

Only supported on textual fields. Maximum is 10.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setContains

Only get facet values that contain the given strings. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".

Only supported on textual fields. Maximum is 10.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getCaseInsensitive

True to make facet keys case insensitive when getting faceting values with prefixes or contains; false otherwise.

Returns
Type Description
bool

setCaseInsensitive

True to make facet keys case insensitive when getting faceting values with prefixes or contains; false otherwise.

Parameter
Name Description
var bool
Returns
Type Description
$this

getOrderBy

The order in which documents are returned.

Allowed values are:

Returns
Type Description
string

setOrderBy

The order in which documents are returned.

Allowed values are:

Parameter
Name Description
var string
Returns
Type Description
$this