Python 2.7 has reached end of support
and will be deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their deprecation date
. We recommend that
you migrate to the latest supported version of Python
.
Facet Classes
Stay organized with collections
Save and categorize content based on your preferences.
Class Facet
is an abstract base class representing a facet of a document. This class should not be directly instantiated.
Facet
is defined in the module google.appengine.api.search
.
Properties
An instance of class Facet
has the following properties:
- name
-
The name of the facet. Facet
names must have maximum length MAXIMUM_FIELD_NAME_LENGTH and match pattern "[A-Za-z][A-Za-
z0-9_]*".
- value
-
The value of the facet which can be a str, unicode or number.
Subclasses
Class Facet
has the following subclasses:
- class
AtomFacet
-
A Facet that has content to be treated as a single token for indexing.
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:
AtomFacet(name='wine_type', value='Red')
-
Exceptions
- TypeError
-
Value supplied is not a text string.
- ValueError
-
Value exceeds maximum allowable length.
- class
NumberFacet
-
A Facet that has a numeric value.
The following example shows a number facet named wine_vintage:
NumberFacet(name='wine_vintage', value=2000)
-
Exceptions
- TypeError
-
Value supplied is not numeric.
- ValueError
-
Value is out of range.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 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."]]