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-07 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-07 UTC."],[[["The `Facet` class is an abstract base class for representing document facets and should not be directly instantiated."],["`Facet` objects have properties for a `name`, which must follow a specific format and length restriction, and a `value`, which can be a string, unicode, or number."],["`AtomFacet` is a subclass of `Facet` 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."],["`NumberFacet` is another subclass of `Facet` where the value is numeric, with errors raised if a non-numeric value is provided or if the value is out of range."],["The `Facet` 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."]]],[]]