public final class Field
extends java.lang.Object
implements java.io.Serializable
Document
, which is a name, an optional locale, and at most one
value: text, HTML, atom, date, GeoPoint, untokenizedPrefix, tokenizedPrefix or vector. Field name
lengths are between 1 and
SearchApiLimits.MAXIMUM_NAME_LENGTH
characters,
and text and HTML values are limited to
SearchApiLimits.MAXIMUM_TEXT_LENGTH
. Atoms are
limited to SearchApiLimits.MAXIMUM_ATOM_LENGTH
characters, both prefix types are limited to
SearchApiLimits.MAXIMUM_PREFIX_LENGTH
. Vector field size is limited to
SearchApiLimits.VECTOR_FIELD_MAX_SIZE
and dates must not have a time component.
There are 5 types of text fields, ATOM, TEXT, HTML, UNTOKENIZED_PREFIX, and TOKENIZED_PREFIX.
Atom fields when queried, are checked for equality. For example, if you add a field with name
code
and an ATOM value of "928A 33B-1", then query code:"928A 33B-1"
would match
the document with this field, while query code:928A
would not. TEXT fields, unlike ATOM,
match both on equality or if any token extracted from the original field matches. Thus if
code
field had the value set with Field.Builder.setText(String)
method, both
queries would match. HTML fields have HTML tags stripped before tokenization. Untokenized prefix
fields match queries that are prefixes containing the contiguous starting characters of the whole
field. For example if the field was "the quick brown fox", the query "the qui" would match
whereas "th qui" would not. On the other hand, Tokenized prefix fields match if the query terms
are prefixes of individual terms in the field. If the query is a phrase of terms, the ordering of
the terms will matter. For example if the field is "the quick brown fox", the query "th qui bro"
would match whereas "bro qui the" would not. Vector fields are only used to compute the dot
product between a given constant vector and the provided vector field for sorting and field
expressions only. for example, if a 3d vector is named "scores" and has a value of (1,2,3) then
the expression dot(scores, vector(3,2,1))
will be evaluated to 10.
Modifier and Type | Class and Description |
---|---|
static class |
Field.Builder
A field builder.
|
static class |
Field.FieldType
The type of the field value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object) |
java.lang.String |
getAtom() |
java.util.Date |
getDate() |
GeoPoint |
getGeoPoint() |
java.lang.String |
getHTML() |
java.util.Locale |
getLocale() |
java.lang.String |
getName() |
java.lang.Double |
getNumber() |
java.lang.String |
getText() |
java.lang.String |
getTokenizedPrefix() |
Field.FieldType |
getType() |
java.lang.String |
getUntokenizedPrefix() |
java.util.List<java.lang.Double> |
getVector() |
int |
hashCode() |
static Field.Builder |
newBuilder()
Creates a field builder.
|
java.lang.String |
toString() |
public java.lang.String getName()
public Field.FieldType getType()
public java.lang.String getText()
public java.lang.String getHTML()
public java.lang.String getAtom()
public java.util.Date getDate()
public java.lang.Double getNumber()
public java.lang.String getUntokenizedPrefix()
public java.lang.String getTokenizedPrefix()
public java.util.List<java.lang.Double> getVector()
public java.util.Locale getLocale()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public static Field.Builder newBuilder()
public java.lang.String toString()
toString
in class java.lang.Object