A Facet Refinement to filter out search results based on a facet value.
Inherits From: expected_type
View aliases
Main aliases
`google.appengine.api.search.search.FacetRefinement`
google.appengine.api.search.FacetRefinement(
name, value=None, facet_range=None
)
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))
Args |
name
|
The name of the facet.
|
value
|
Value of the facet.
|
facet_range
|
A FacetRange to refine facet based on a range.
|
Raises |
TypeError
|
If any of the parameters have invalid types, or an unknown
attribute is passed.
|
ValueError
|
If any of the parameters have invalid values.
|
Attributes |
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
@staticmethod
FromTokenString(
token_string
)
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
ToTokenString()
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.
|