Class Field
- java.lang.Object
-
- com.google.appengine.api.search.Field
-
- All Implemented Interfaces:
- java.io.Serializable
public final class Field extends java.lang.Object implements java.io.SerializableRepresents 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 and 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 and Description booleanequals(java.lang.Object object)java.lang.StringgetAtom()java.util.DategetDate()GeoPointgetGeoPoint()java.lang.StringgetHTML()java.util.LocalegetLocale()java.lang.StringgetName()java.lang.DoublegetNumber()java.lang.StringgetText()java.lang.StringgetTokenizedPrefix()Field.FieldTypegetType()java.lang.StringgetUntokenizedPrefix()java.util.List<java.lang.Double>getVector()inthashCode()static Field.BuildernewBuilder()Creates a field builder.java.lang.StringtoString()
-
-
-
Method Detail
-
getName
public java.lang.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 java.lang.String getText()
- Returns:
- the text value of the field. Can be null
-
getHTML
public java.lang.String getHTML()
- Returns:
- the HTML value of the field. Can be null
-
getAtom
public java.lang.String getAtom()
- Returns:
- the atomic value of the field. Can be null
-
getDate
public java.util.Date getDate()
- Returns:
- the date value of the field. Can be null
-
getNumber
public java.lang.Double getNumber()
- Returns:
- the numeric value of the field. Can be null
-
getUntokenizedPrefix
public java.lang.String getUntokenizedPrefix()
- Returns:
- the String value of the untokenized prefix field. Can be null
-
getTokenizedPrefix
public java.lang.String getTokenizedPrefix()
- Returns:
- the String value of the tokenized prefix field. Can be null
-
getVector
public java.util.List<java.lang.Double> getVector()
- Returns:
- the vector value of the field.
-
getLocale
public java.util.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
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
newBuilder
public static Field.Builder newBuilder()
Creates a field builder.- Returns:
- a new builder for creating fields
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-