Class Facet (2.0.0)

public final class Facet implements Serializable

A Facet can be used to categorize a Document. It is not a Field.

Search results can contain facets for the extended result set and their value frequency. For example, if a search query is related to "wine", then facets could be "color" with values of "red" and "white", and "year" with values of "2000" and "2005".

Each facet has a name and exactly one value: atom or number. Facet name lengths are between 1 and com.google.appengine.api.search.checkers.SearchApiLimits#MAXIMUM_NAME_LENGTH characters, and atoms are limited to com.google.appengine.api.search.checkers.SearchApiLimits#MAXIMUM_ATOM_LENGTH characters. Numbers must be between com.google.appengine.api.search.checkers.SearchApiLimits#MINIMUM_NUMBER_VALUE and com.google.appengine.api.search.checkers.SearchApiLimits#MAXIMUM_NUMBER_VALUE.

Inheritance

Object > Facet

Implements

Serializable

Static Methods

withAtom(String name, String value)

public static Facet withAtom(String name, String value)

Creates and returns an atom facet with the given name and value.

Parameters
NameDescription
nameString
valueString
Returns
TypeDescription
Facet

an instance of Facet.

withNumber(String name, Double value)

public static Facet withNumber(String name, Double value)

Creates and returns a number facet with the given name and value.

Parameters
NameDescription
nameString
valueDouble
Returns
TypeDescription
Facet

an instance of Facet.

Methods

equals(Object object)

public boolean equals(Object object)
Parameter
NameDescription
objectObject
Returns
TypeDescription
boolean
Overrides

getAtom()

public String getAtom()

Returns the atomic value of the facet. Returns null if the value is not atomic.

Returns
TypeDescription
String

getName()

public String getName()

Returns the name of the facet.

Returns
TypeDescription
String

getNumber()

public Double getNumber()

Returns the numeric value of the facet. Returns null if the value is not numeric.

Returns
TypeDescription
Double

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

toString()

public String toString()
Returns
TypeDescription
String
Overrides