google.appengine.api.search.FacetRefinement

A Facet Refinement to filter out search results based on a facet value.

Inherits From: expected_type

NOTE: The recommended way to use facet refinement is to use the token string. Each FacetResult will have a token that is acceptable instead of this class. To provide manual FacetRefinement, an instance of this class can be passed to SearchOptions. NOTE: that either value or facet_range should be set but not both. Example: Request for a range refinement for a numeric facet: FacetRefinement(name='rating', facet_range=FacetRange(start=1.0,end=2.5))

name The name of the facet.
value Value of the facet.
facet_range A FacetRange to refine facet based on a range.

TypeError If any of the parameters have invalid types, or an unknown attribute is passed.
ValueError If any of the parameters have invalid values.

facet_range Returns range of the facet refinement.
name Returns name of the facet refinement.
value Returns value of the facet refinement.

Methods

FromTokenString

View source

Converts a token string to a FacetRefinement object.

Do not store token strings between different versions of API as key could be incompatible.

Args
token_string A token string created by ToTokenString method or returned by a search result.

Returns
A FacetRefinement object.

Raises
ValueError If the token_string is invalid.

ToTokenString

View source

Converts this refinement to a token string safe to be used in HTML.

The format of this string may change.

Returns
A token string safe to be used in HTML for this facet refinement.