public sealed class SearchRequest.Types.FacetSpec.Types.FacetKey : IMessage<SearchRequest.Types.FacetSpec.Types.FacetKey>, IEquatable<SearchRequest.Types.FacetSpec.Types.FacetKey>, IDeepCloneable<SearchRequest.Types.FacetSpec.Types.FacetKey>, IBufferMessage, IMessage
Reference documentation and code samples for the Discovery Engine v1 API class SearchRequest.Types.FacetSpec.Types.FacetKey.
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.
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.
Required. Supported textual and numerical facet keys in
[Document][google.cloud.discoveryengine.v1.Document] object, over which
the facet values are computed. Facet key is case-sensitive.
"count desc", which means order by
[SearchResponse.Facet.values.count][google.cloud.discoveryengine.v1.SearchResponse.Facet.FacetValue.count]
descending.
"value desc", which means order by
[SearchResponse.Facet.values.value][google.cloud.discoveryengine.v1.SearchResponse.Facet.FacetValue.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][google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKey.intervals].
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.
public RepeatedField<string> RestrictedValues { get; }
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSearchRequest.Types.FacetSpec.Types.FacetKey\u003c/code\u003e class is a part of the Google Cloud Discovery Engine v1 API and is used to specify how a facet is computed.\u003c/p\u003e\n"],["\u003cp\u003eThis class has multiple properties, including \u003ccode\u003eCaseInsensitive\u003c/code\u003e, \u003ccode\u003eContains\u003c/code\u003e, \u003ccode\u003eIntervals\u003c/code\u003e, \u003ccode\u003eKey\u003c/code\u003e, \u003ccode\u003eOrderBy\u003c/code\u003e, \u003ccode\u003ePrefixes\u003c/code\u003e, and \u003ccode\u003eRestrictedValues\u003c/code\u003e, each controlling various aspects of facet computation like case sensitivity, filtering by string values, interval bucketing for numerical values, and ordering.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFacetKey\u003c/code\u003e class is serializable, equatable and deep cloneable, also implementing \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIBufferMessage\u003c/code\u003e, and \u003ccode\u003eIEquatable\u003c/code\u003e, which enables it to be used with the .NET libraries for data interchange and manipulation.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version for this API class is \u003ccode\u003e1.6.0\u003c/code\u003e, with previous versions including \u003ccode\u003e1.5.0\u003c/code\u003e, \u003ccode\u003e1.4.0\u003c/code\u003e, \u003ccode\u003e1.3.0\u003c/code\u003e, \u003ccode\u003e1.2.0\u003c/code\u003e, \u003ccode\u003e1.1.0\u003c/code\u003e, and \u003ccode\u003e1.0.0-beta06\u003c/code\u003e also documented.\u003c/p\u003e\n"]]],[],null,["# Discovery Engine v1 API - Class SearchRequest.Types.FacetSpec.Types.FacetKey (1.9.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.9.0 (latest)](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.8.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.8.0/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.7.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.7.0/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.6.0/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.5.0/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.4.0/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.3.0/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.2.0/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.1.0/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.0.0-beta06](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.0.0-beta06/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey) \n\n public sealed class SearchRequest.Types.FacetSpec.Types.FacetKey : IMessage\u003cSearchRequest.Types.FacetSpec.Types.FacetKey\u003e, IEquatable\u003cSearchRequest.Types.FacetSpec.Types.FacetKey\u003e, IDeepCloneable\u003cSearchRequest.Types.FacetSpec.Types.FacetKey\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Discovery Engine v1 API class SearchRequest.Types.FacetSpec.Types.FacetKey.\n\nSpecifies how a facet is computed. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e SearchRequest.Types.FacetSpec.Types.FacetKey \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[SearchRequest](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types)[FacetSpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types)[FacetKey](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SearchRequest](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types)[FacetSpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types)[FacetKey](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[SearchRequest](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types)[FacetSpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types)[FacetKey](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.SearchRequest.Types.FacetSpec.Types.FacetKey), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.DiscoveryEngine.V1](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.DiscoveryEngine.V1.dll\n\nConstructors\n------------\n\n### FacetKey()\n\n public FacetKey()\n\n### FacetKey(FacetKey)\n\n public FacetKey(SearchRequest.Types.FacetSpec.Types.FacetKey other)\n\nProperties\n----------\n\n### CaseInsensitive\n\n public bool CaseInsensitive { get; set; }\n\nTrue to make facet keys case insensitive when getting faceting\nvalues with prefixes or contains; false otherwise.\n\n### Contains\n\n public RepeatedField\u003cstring\u003e Contains { get; }\n\nOnly get facet values that contain the given strings. For example,\nsuppose \"category\" has three values \"Action \\\u003e 2022\",\n\"Action \\\u003e 2021\" and \"Sci-Fi \\\u003e 2022\". If set \"contains\" to \"2022\", the\n\"category\" facet only contains \"Action \\\u003e 2022\" and \"Sci-Fi \\\u003e 2022\".\nOnly supported on textual fields. Maximum is 10.\n\n### Intervals\n\n public RepeatedField\u003cInterval\u003e Intervals { get; }\n\nSet only if values should be bucketed into intervals. Must be set\nfor facets with numerical values. Must not be set for facet with text\nvalues. Maximum number of intervals is 30.\n\n### Key\n\n public string Key { get; set; }\n\nRequired. Supported textual and numerical facet keys in\n\\[Document\\]\\[google.cloud.discoveryengine.v1.Document\\] object, over which\nthe facet values are computed. Facet key is case-sensitive.\n\n### OrderBy\n\n public string OrderBy { get; set; }\n\nThe order in which documents are returned.\n\nAllowed values are:\n\n- \"count desc\", which means order by\n \\[SearchResponse.Facet.values.count\\]\\[google.cloud.discoveryengine.v1.SearchResponse.Facet.FacetValue.count\\]\n descending.\n\n- \"value desc\", which means order by\n \\[SearchResponse.Facet.values.value\\]\\[google.cloud.discoveryengine.v1.SearchResponse.Facet.FacetValue.value\\]\n descending.\n Only applies to textual facets.\n\nIf not set, textual values are sorted in [natural\norder](https://en.wikipedia.org/wiki/Natural_sort_order); numerical\nintervals are sorted in the order given by\n\\[FacetSpec.FacetKey.intervals\\]\\[google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKey.intervals\\].\n\n### Prefixes\n\n public RepeatedField\u003cstring\u003e Prefixes { get; }\n\nOnly get facet values that start with the given string prefix. For\nexample, suppose \"category\" has three values \"Action \\\u003e 2022\",\n\"Action \\\u003e 2021\" and \"Sci-Fi \\\u003e 2022\". If set \"prefixes\" to \"Action\", the\n\"category\" facet only contains \"Action \\\u003e 2022\" and \"Action \\\u003e 2021\".\nOnly supported on textual fields. Maximum is 10.\n\n### RestrictedValues\n\n public RepeatedField\u003cstring\u003e RestrictedValues { get; }\n\nOnly get facet for the given restricted values. Only supported on\ntextual fields. For example, suppose \"category\" has three values\n\"Action \\\u003e 2022\", \"Action \\\u003e 2021\" and \"Sci-Fi \\\u003e 2022\". If set\n\"restricted_values\" to \"Action \\\u003e 2022\", the \"category\" facet only\ncontains \"Action \\\u003e 2022\". Only supported on textual fields. Maximum\nis 10."]]