Class Field
- java.lang.Object
-
- com.google.appengine.api.search.Field
-
- All Implemented Interfaces:
Serializable
public final class Field extends Object implements Serializable
Represents a field of aDocument, 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 andSearchApiLimits.MAXIMUM_NAME_LENGTHcharacters, and text and HTML values are limited toSearchApiLimits.MAXIMUM_TEXT_LENGTH. Atoms are limited toSearchApiLimits.MAXIMUM_ATOM_LENGTHcharacters, both prefix types are limited toSearchApiLimits.MAXIMUM_PREFIX_LENGTH. Vector field size is limited toSearchApiLimits.VECTOR_FIELD_MAX_SIZEand 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
codeand an ATOM value of "928A 33B-1", then querycode:"928A 33B-1"would match the document with this field, while querycode:928Awould not. TEXT fields, unlike ATOM, match both on equality or if any token extracted from the original field matches. Thus ifcodefield had the value set withField.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 expressiondot(scores, vector(3,2,1))will be evaluated to 10.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classField.BuilderA field builder.static classField.FieldTypeThe type of the field value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)StringgetAtom()DategetDate()GeoPointgetGeoPoint()StringgetHTML()LocalegetLocale()StringgetName()DoublegetNumber()StringgetText()StringgetTokenizedPrefix()Field.FieldTypegetType()StringgetUntokenizedPrefix()List<Double>getVector()inthashCode()static Field.BuildernewBuilder()Creates a field builder.StringtoString()
-
-
-
Method Detail
-
getName
public String getName()
- Returns:
- the name of the field
-
getType
public Field.FieldType getType()
- Returns:
- the type of value of the field. Can be null
-
getText
public String getText()
- Returns:
- the text value of the field. Can be null
-
getHTML
public String getHTML()
- Returns:
- the HTML value of the field. Can be null
-
getAtom
public String getAtom()
- Returns:
- the atomic value of the field. Can be null
-
getDate
public Date getDate()
- Returns:
- the date value of the field. Can be null
-
getNumber
public Double getNumber()
- Returns:
- the numeric value of the field. Can be null
-
getUntokenizedPrefix
public String getUntokenizedPrefix()
- Returns:
- the String value of the untokenized prefix field. Can be null
-
getTokenizedPrefix
public String getTokenizedPrefix()
- Returns:
- the String value of the tokenized prefix field. Can be null
-
getLocale
public Locale getLocale()
- Returns:
- the locale the field value is written in. Can be null. If none is given the locale of the document will be used
-
newBuilder
public static Field.Builder newBuilder()
Creates a field builder.- Returns:
- a new builder for creating fields
-
-