Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.

Python 2 is no longer supported by the community. We recommend that you migrate Python 2 apps to Python 3.

Facet Classes

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.