Package com.google.appengine.api.search
Class Field.Builder
- java.lang.Object
-
- com.google.appengine.api.search.Field.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Fieldbuild()Builds a field using this builder.Field.BuildersetAtom(String atom)Sets an atomic value, indivisible text, for the field.Field.BuildersetDate(Date date)Sets a date associated with the field.Field.BuildersetGeoPoint(GeoPoint geoPoint)Sets aGeoPointvalue for the field.Field.BuildersetHTML(String html)Sets a HTML value for the field.Field.BuildersetLocale(Locale locale)Sets the Locale of the field value.Field.BuildersetName(String name)Sets a name for the field.Field.BuildersetNumber(double number)Sets a numeric value for the field.Field.BuildersetText(String text)Sets a text value for the field.Field.BuildersetTokenizedPrefix(String tokenizedPrefix)Sets a tokenized prefix value for the field.Field.BuildersetUntokenizedPrefix(String untokenizedPrefix)Sets an untokenized prefix value for the field.Field.BuildersetVector(List<Double> vector)Sets a vector value for the field.
-
-
-
Method Detail
-
setName
public Field.Builder setName(String name)
Sets a name for the field. The field name length must be between 1 and FieldChecker#MAXIMUM_NAME_LENGTH and it should matchSearchApiLimits.FIELD_NAME_PATTERN.- Parameters:
name- the name of the field- Returns:
- this builder
- Throws:
IllegalArgumentException- if the name or value is invalid
-
setText
public Field.Builder setText(String text)
Sets a text value for the field.- Parameters:
text- the text value of the field- Returns:
- this builder
- Throws:
IllegalArgumentException- if the text is invalid
-
setHTML
public Field.Builder setHTML(String html)
Sets a HTML value for the field.- Parameters:
html- the HTML value of the field- Returns:
- this builder
- Throws:
IllegalArgumentException- if the HTML is invalid
-
setAtom
public Field.Builder setAtom(String atom)
Sets an atomic value, indivisible text, for the field.- Parameters:
atom- the indivisible text of the field- Returns:
- this builder
- Throws:
IllegalArgumentException- if the atom is invalid
-
setDate
public Field.Builder setDate(Date date)
Sets a date associated with the field.- Parameters:
date- the date of the field- Returns:
- this builder
- Throws:
IllegalArgumentException- if the date is out of range
-
setNumber
public Field.Builder setNumber(double number)
Sets a numeric value for the field. Thenumbermust be betweenSearchApiLimits.MINIMUM_NUMBER_VALUEandSearchApiLimits.MAXIMUM_NUMBER_VALUE.- Parameters:
number- the numeric value of the field- Returns:
- this builder
- Throws:
IllegalArgumentException- if the number is outside the valid range
-
setGeoPoint
public Field.Builder setGeoPoint(GeoPoint geoPoint)
Sets aGeoPointvalue for the field.- Parameters:
geoPoint- theGeoPointvalue of the field- Returns:
- this builder
-
setUntokenizedPrefix
public Field.Builder setUntokenizedPrefix(String untokenizedPrefix)
Sets an untokenized prefix value for the field.- Parameters:
untokenizedPrefix- the string value of the field- Returns:
- this builder
- Throws:
IllegalArgumentException- if the untokenized prefix field is invalid
-
setTokenizedPrefix
public Field.Builder setTokenizedPrefix(String tokenizedPrefix)
Sets a tokenized prefix value for the field.- Parameters:
tokenizedPrefix- the string value of the field- Returns:
- this builder
- Throws:
IllegalArgumentException- if the tokenized prefix field is invalid
-
setVector
public Field.Builder setVector(List<Double> vector)
Sets a vector value for the field.- Parameters:
vector- a list of Double values forming a vector field value- Returns:
- this builder
- Throws:
IllegalArgumentException- if the vector field is invalid
-
setLocale
public Field.Builder setLocale(Locale locale)
Sets the Locale of the field value. If none is given, then the locale of the document will be used.- Parameters:
locale- the locale the field value is written in- Returns:
- this builder
-
build
public Field build()
Builds a field using this builder. The field must have a valid name, string value, type.- Returns:
- a
Fieldbuilt by this builder - Throws:
IllegalArgumentException- if the field has an invalid name, text, HTML, atom, date
-
-