Python 2.7 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Python 2.7 アプリケーションをデプロイできなくなります。既存の Python 2.7 アプリケーションは、
非推奨日以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Python に移行することをおすすめします。
FacetRefinement クラス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
FacetRefinement
クラスは、ファセット値に基づいて検索結果を絞り込むために使用します。
ファセット絞り込みの使用方法として推奨されるのは、トークン文字列を使用する方法です。各 FacetResult は、このクラスではなく、許容可能なトークンを持ちます。手動の FacetRefinement を提供するために、このクラスのインスタンスを SearchOptions に渡すことができます。
FacetRefinement
は、google.appengine.api.search
モジュールで定義されます。
コンストラクタ
FacetRefinement
クラスのコンストラクタは、次のように定義されます。
class FacetRefinement(name, value=None, facet_range=None)
クラス FacetRefinement
のインスタンスを作成します。
注: 値または facet_range のどちらかを指定します。両方は指定しないでください。
引数
- name
name プロパティを設定します。
- value
value プロパティを設定します。
- facet_range
facet_range プロパティを設定します。
結果値
FacetRefinement
クラスの新しいインスタンス。
例外
- TypeError
いずれかのパラメータが無効なタイプであるか、不明な属性が渡された場合。
- ValueError
いずれかのパラメータに無効な値がある場合
プロパティ
FacetRefinement
クラスのインスタンスには次のプロパティがあります。
- name
ファセット絞り込みの名前。
- value
ファセット絞り込みの文字列値。
- range
ファセット絞り込みの数値範囲。
インスタンス メソッド
FacetRefinement
クラスのインスタンスには次のメソッドがあります。
- ToTokenString()
この絞り込みを、HTML でも安全に使用できるトークン文字列に変換します。この文字列の形式は変更されることがあります。
-
結果値
HTML でも安全に使用できる、このファセット絞り込みのトークン文字列。
- FromTokenString()
この静的メソッドは、トークン文字列を FacetRefinement オブジェクトに変換します。キーに互換性がない場合があるため、異なるバージョンの API の間ではトークン文字列を保存しないでください。
-
引数
- token_string
ToTokenString メソッドによって作成される、または検索結果で返されるトークン文字列。
結果値
FacetRefinement オブジェクト。
例外
- ValueError
token_string が無効である場合。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eThe \u003ccode\u003eFacetRefinement\u003c/code\u003e class is used to refine search results based on a specific facet value.\u003c/p\u003e\n"],["\u003cp\u003eWhile manual \u003ccode\u003eFacetRefinement\u003c/code\u003e is possible, using the token string from \u003ccode\u003eFacetResult\u003c/code\u003e is the recommended approach.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFacetRefinement\u003c/code\u003e constructor accepts a name, a value, or a \u003ccode\u003efacet_range\u003c/code\u003e, but only one of the value or facet_range can be specified.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFacetRefinement\u003c/code\u003e instances have \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003evalue\u003c/code\u003e, and \u003ccode\u003erange\u003c/code\u003e properties that define the refinement.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFacetRefinement\u003c/code\u003e objects can be converted to token strings using \u003ccode\u003eToTokenString()\u003c/code\u003e and can be created from a token string using the \u003ccode\u003eFromTokenString()\u003c/code\u003e method.\u003c/p\u003e\n"]]],[],null,["# The FacetRefinement Class\n\nClass `FacetRefinement` is used to narrow search results based on a facet value.\n\nThe recommended way to use facet refinement is to use its token string. Each FacetResult will\nhave a token that is acceptable instead of this class. To provide manual FacetRefinement, an\ninstance of this class can be passed to SearchOptions.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| python3\n|\n| /services/access). If you are updating to the App Engine Python 3 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/python-differences) to learn about your migration options for legacy bundled services.\n\n`FacetRefinement` is defined in the module `google.appengine.api.search`.\n\nConstructor\n-----------\n\nThe constructor for class `FacetRefinement` is defined as follows:\n\nclass FacetRefinement(name, value=None, facet_range=None)\n\n: Construct an instance of class `FacetRefinement`.\n\n NOTE: Either the value or the facet_range should be set but not both.\n\n:\n\n Arguments\n\n name\n\n : Sets the name property\n\n value\n\n : Sets the value property\n\n facet_range\n\n : Sets the facet_range property\n\n Result value\n\n : A new instance of class `FacetRefinement`.\n\n Exceptions\n\n TypeError\n\n : If any of the parameters have invalid types, or an unknown\n attribute is passed.\n\n ValueError\n\n : If any of the parameters have invalid values.\n\n \u003cbr /\u003e\n\n\u003cbr /\u003e\n\nProperties\n----------\n\nAn instance of class `FacetRefinement` has the following properties:\n\nname\n\n: name of the facet refinement.\n\nvalue\n\n: string value of the facet refinement.\n\nrange\n\n: numeric range of the facet refinement.\n\nInstance Methods\n----------------\n\nInstances of class `FacetRefinement` have the following methods:\n\nToTokenString()\n\n: Converts this refinement to a token string safe to be used in HTML. The format of this string may change.\n\n: Result value\n\n : A token string safe to be used in HTML for this facet refinement.\n\nFromTokenString()\n\n: This static method converts a token string to a FacetRefinement object. Do not store token strings between different versions of API as key could\n be incompatible.\n\n: Arguments\n\n token_string\n\n : A token string created by ToTokenString method or returned\n by a search result.\n\n Result value\n\n : A FacetRefinement object.\n\n Exceptions\n\n ValueError\n\n : If the token_string is invalid."]]