com.google.appengine.api.search

## 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.Serializable

  Represents a field of a `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.

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Field.Builder` A field builder.
    `static class` | `Field.FieldType` The type of the field value.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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()`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### 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

    - #### getGeoPoint

          public GeoPoint getGeoPoint()

      Returns:
        the `GeoPoint` 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:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object object)

      Overrides:
        `equals` in class `java.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:
        `toString` in class `java.lang.Object`