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 v1beta 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.v1beta.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.v1beta.SearchResponse.Facet.FacetValue.count]
descending.
"value desc", which means order by
[SearchResponse.Facet.values.value][google.cloud.discoveryengine.v1beta.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.v1beta.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\u003eFacetKey\u003c/code\u003e class is part of the Discovery Engine v1beta API, specifically within the \u003ccode\u003eSearchRequest.Types.FacetSpec.Types\u003c/code\u003e namespace, and defines how a facet is computed.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of this class is \u003ccode\u003e1.0.0-beta18\u003c/code\u003e, and it implements interfaces like \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis class offers properties for configuring facets, such as \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, which allow customization of facet key behavior.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFacetKey\u003c/code\u003e supports textual and numerical facets, enabling operations like filtering by prefixes, containing specific strings, or defining numerical intervals.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFacetKey\u003c/code\u003e class has constructors to make a new instance, and also to make a new copy of another instance.\u003c/p\u003e\n"]]],[],null,["# Discovery Engine v1beta API - Class SearchRequest.Types.FacetSpec.Types.FacetKey (1.0.0-beta19)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.0-beta19 (latest)](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types.FacetSpec.Types.FacetKey)\n- [1.0.0-beta18](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/1.0.0-beta18/Google.Cloud.DiscoveryEngine.V1Beta.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 v1beta 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.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types)[FacetSpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types.FacetSpec)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types.FacetSpec.Types)[FacetKey](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types.FacetSpec.Types.FacetKey), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SearchRequest](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types)[FacetSpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types.FacetSpec)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types.FacetSpec.Types)[FacetKey](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.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.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types)[FacetSpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types.FacetSpec)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.SearchRequest.Types.FacetSpec.Types)[FacetKey](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.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.V1Beta](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta)\n\nAssembly\n--------\n\nGoogle.Cloud.DiscoveryEngine.V1Beta.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.v1beta.Document\\] object, over\nwhich the 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.v1beta.SearchResponse.Facet.FacetValue.count\\]\n descending.\n\n- \"value desc\", which means order by\n \\[SearchResponse.Facet.values.value\\]\\[google.cloud.discoveryengine.v1beta.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.v1beta.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."]]