Package com.google.appengine.api.search
Class Facet
- java.lang.Object
-
- com.google.appengine.api.search.Facet
-
- All Implemented Interfaces:
Serializable
public final class Facet extends Object implements Serializable
AFacetcan be used to categorize aDocument. It is not aField.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
SearchApiLimits.MAXIMUM_NAME_LENGTHcharacters, and atoms are limited toSearchApiLimits.MAXIMUM_ATOM_LENGTHcharacters. Numbers must be betweenSearchApiLimits.MINIMUM_NUMBER_VALUEandSearchApiLimits.MAXIMUM_NUMBER_VALUE.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)StringgetAtom()Returns the atomic value of the facet.StringgetName()Returns the name of the facet.DoublegetNumber()Returns the numeric value of the facet.inthashCode()StringtoString()static FacetwithAtom(String name, String value)Creates and returns an atom facet with the givennameandvalue.static FacetwithNumber(String name, Double value)Creates and returns a number facet with the givennameandvalue.
-
-
-
Method Detail
-
withAtom
public static Facet withAtom(String name, String value)
Creates and returns an atom facet with the givennameandvalue.- Returns:
- an instance of
Facet. - Throws:
IllegalArgumentException- if the facet name or value are invalid.
-
withNumber
public static Facet withNumber(String name, Double value)
Creates and returns a number facet with the givennameandvalue.- Returns:
- an instance of
Facet. - Throws:
IllegalArgumentException- if the facet name or value are invalid.
-
getName
public String getName()
Returns the name of the facet.
-
getAtom
public String getAtom()
Returns the atomic value of the facet. Returns null if the value is not atomic.
-
getNumber
public Double getNumber()
Returns the numeric value of the facet. Returns null if the value is not numeric.
-
-