public final class Facet
extends java.lang.Object
implements java.io.Serializable
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
SearchApiLimits.MAXIMUM_NAME_LENGTH
characters,
and atoms are
limited to SearchApiLimits.MAXIMUM_ATOM_LENGTH
characters. Numbers must be between
SearchApiLimits.MINIMUM_NUMBER_VALUE
and
SearchApiLimits.MAXIMUM_NUMBER_VALUE
.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object) |
java.lang.String |
getAtom()
Returns the atomic value of the facet.
|
java.lang.String |
getName()
Returns the name of the facet.
|
java.lang.Double |
getNumber()
Returns the numeric value of the facet.
|
int |
hashCode() |
java.lang.String |
toString() |
static Facet |
withAtom(java.lang.String name,
java.lang.String value)
Creates and returns an atom facet with the given
name and value . |
static Facet |
withNumber(java.lang.String name,
java.lang.Double value)
Creates and returns a number facet with the given
name and value . |
public static Facet withAtom(java.lang.String name, java.lang.String value)
name
and value
.Facet
.java.lang.IllegalArgumentException
- if the facet name or value are invalid.public static Facet withNumber(java.lang.String name, java.lang.Double value)
name
and value
.Facet
.java.lang.IllegalArgumentException
- if the facet name or value are invalid.public java.lang.String getName()
public java.lang.String getAtom()
public java.lang.Double getNumber()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object