Python 2.7 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Python 2.7 アプリケーションをデプロイできなくなります。既存の Python 2.7 アプリケーションは、
非推奨日以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Python に移行することをおすすめします。
Facet クラス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Facet
クラスは、ドキュメントのファセットを表す基本の抽象クラスです。このクラスは直接インスタンス化できません。
Facet
は、google.appengine.api.search
モジュールで定義されます。
プロパティ
Facet
クラスのインスタンスには次のプロパティがあります。
- name
ファセットの名前。ファセット名は MAXIMUM_FIELD_NAME_LENGTH 文字以内で指定し、パターン「[A-Za-z][A-Za-z0-9_]*」に一致している必要があります。
- value
ファセットの値。文字列、Unicode、または数値で指定します。
サブクラス
Facet
クラスには次のサブクラスがあります。
- class AtomFacet
インデックスに登録するため、単一のトークンとして扱われるコンテンツを持つファセット。
ファセットの値は、非表示のテキスト値として処理される文字列または Unicode オブジェクトです。次の例は、wine_type という名前のアトム ファセットを示します。
AtomFacet(name='wine_type', value='Red')
-
例外
- TypeError
指定された値がテキスト文字列ではありません。
- ValueError
値が、許容される長さの上限を超えています。
- class NumberFacet
数値を持つファセット。
次の例は wine_vintage という名前の数値ファセットを示しています。
NumberFacet(name='wine_vintage', value=2000)
-
例外
- TypeError
指定された値が数字ではありません。
- ValueError
範囲外の値が使われています。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 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\u003eFacet\u003c/code\u003e class is an abstract base class for representing document facets and should not be directly instantiated.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFacet\u003c/code\u003e objects have properties for a \u003ccode\u003ename\u003c/code\u003e, which must follow a specific format and length restriction, and a \u003ccode\u003evalue\u003c/code\u003e, which can be a string, unicode, or number.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAtomFacet\u003c/code\u003e is a subclass of \u003ccode\u003eFacet\u003c/code\u003e where the value is treated as a single text token, and errors are raised if the value is not a text string or exceeds the maximum length.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eNumberFacet\u003c/code\u003e is another subclass of \u003ccode\u003eFacet\u003c/code\u003e where the value is numeric, with errors raised if a non-numeric value is provided or if the value is out of range.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFacet\u003c/code\u003e API is supported for first-generation runtimes and has considerations when upgrading to the second-generation App Engine Python 3 runtime, outlined in a migration guide.\u003c/p\u003e\n"]]],[],null,["# Facet Classes\n\nClass `Facet` is an abstract base class representing a facet of a document. This class should not be directly instantiated.\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`Facet` is defined in the module `google.appengine.api.search`.\n\nProperties\n----------\n\nAn instance of class `Facet` has the following properties:\n\nname\n\n: The name of the facet. Facet\n names must have maximum length MAXIMUM_FIELD_NAME_LENGTH and match pattern \"\\[A-Za-z\\]\\[A-Za-\n z0-9_\\]\\*\".\n\nvalue\n\n: The value of the facet which can be a str, unicode or number.\n\nSubclasses\n----------\n\nClass `Facet` has the following subclasses:\n\n\nclass AtomFacet\n\n: A Facet that has content to be treated as a single token for indexing.\n\n The facet's value is a str or unicode object to be treated as an indivisible text value. The following example shows an atom facet named wine_type: \n\n ```\n AtomFacet(name='wine_type', value='Red')\n ```\n\n: Exceptions\n\n TypeError\n\n : Value supplied is not a text string.\n\n ValueError\n\n : Value exceeds maximum allowable length.\n\n\nclass NumberFacet\n\n: A Facet that has a numeric value.\n\n The following example shows a number facet named wine_vintage: \n\n ```\n NumberFacet(name='wine_vintage', value=2000)\n ```\n\n: Exceptions\n\n TypeError\n\n : Value supplied is not numeric.\n\n ValueError\n\n : Value is out of range."]]