Class AbstractField

    • Field Detail

      • storeTermVector

        protected boolean storeTermVector
      • storeOffsetWithTermVector

        protected boolean storeOffsetWithTermVector
      • storePositionWithTermVector

        protected boolean storePositionWithTermVector
      • omitNorms

        protected boolean omitNorms
      • isStored

        protected boolean isStored
      • isIndexed

        protected boolean isIndexed
      • isTokenized

        protected boolean isTokenized
      • isBinary

        protected boolean isBinary
      • lazy

        protected boolean lazy
      • boost

        protected float boost
      • fieldsData

        protected Object fieldsData
      • binaryLength

        protected int binaryLength
      • binaryOffset

        protected int binaryOffset
    • Method Detail

      • getBoost

        public float getBoost()
        Returns the boost factor for hits for this field.

        The default value is 1.0.

        Note: this value is not stored directly with the document in the index. Documents returned from IndexReader.document(int) and Searcher.doc(int) may thus not have the same value present as when this field was indexed.

        Specified by:
        getBoost in interface Fieldable
        See Also:
        setBoost(float)
      • name

        public String name()
        Returns the name of the field as an interned string. For example "date", "title", "body", ...
        Specified by:
        name in interface Fieldable
      • setStoreTermVector

        protected void setStoreTermVector​(Field.TermVector termVector)
      • isStored

        public final boolean isStored()
        True iff the value of the field is to be stored in the index for return with search hits. It is an error for this to be true if a field is Reader-valued.
        Specified by:
        isStored in interface Fieldable
      • isIndexed

        public final boolean isIndexed()
        True iff the value of the field is to be indexed, so that it may be searched on.
        Specified by:
        isIndexed in interface Fieldable
      • isTokenized

        public final boolean isTokenized()
        True iff the value of the field should be tokenized as text prior to indexing. Un-tokenized fields are indexed as a single word and may not be Reader-valued.
        Specified by:
        isTokenized in interface Fieldable
      • isStoreOffsetWithTermVector

        public boolean isStoreOffsetWithTermVector()
        True iff terms are stored as term vector together with their offsets (start and end position in source text).
        Specified by:
        isStoreOffsetWithTermVector in interface Fieldable
      • isStorePositionWithTermVector

        public boolean isStorePositionWithTermVector()
        True iff terms are stored as term vector together with their token positions.
        Specified by:
        isStorePositionWithTermVector in interface Fieldable
      • isBinary

        public final boolean isBinary()
        True iff the value of the filed is stored as binary
        Specified by:
        isBinary in interface Fieldable
      • getBinaryValue

        public byte[] getBinaryValue()
        Return the raw byte[] for the binary field. Note that you must also call getBinaryLength() and getBinaryOffset() to know which range of bytes in this returned array belong to the field.
        Specified by:
        getBinaryValue in interface Fieldable
        Returns:
        reference to the Field value as byte[].
      • getBinaryValue

        public byte[] getBinaryValue​(byte[] result)
        Description copied from interface: Fieldable
        Return the raw byte[] for the binary field. Note that you must also call Fieldable.getBinaryLength() and Fieldable.getBinaryOffset() to know which range of bytes in this returned array belong to the field.

        About reuse: if you pass in the result byte[] and it is used, likely the underlying implementation will hold onto this byte[] and return it in future calls to Fieldable.getBinaryValue(). So if you subsequently re-use the same byte[] elsewhere it will alter this Fieldable's value.

        Specified by:
        getBinaryValue in interface Fieldable
        Parameters:
        result - User defined buffer that will be used if possible. If this is null or not large enough, a new buffer is allocated
        Returns:
        reference to the Field value as byte[].
      • getBinaryLength

        public int getBinaryLength()
        Returns length of byte[] segment that is used as value, if Field is not binary returned value is undefined
        Specified by:
        getBinaryLength in interface Fieldable
        Returns:
        length of byte[] segment that represents this Field value
      • getBinaryOffset

        public int getBinaryOffset()
        Returns offset into byte[] segment that is used as value, if Field is not binary returned value is undefined
        Specified by:
        getBinaryOffset in interface Fieldable
        Returns:
        index of the first character in byte[] segment that represents this Field value
      • getOmitNorms

        public boolean getOmitNorms()
        True if norms are omitted for this indexed field
        Specified by:
        getOmitNorms in interface Fieldable
      • setOmitNorms

        public void setOmitNorms​(boolean omitNorms)
        Expert: If set, omit normalization factors associated with this indexed field. This effectively disables indexing boosts and length normalization for this field.
        Specified by:
        setOmitNorms in interface Fieldable
      • setIndexOptions

        public void setIndexOptions​(FieldInfo.IndexOptions indexOptions)
        Expert: If set, omit term freq, and optionally also positions and payloads from postings for this field.

        NOTE: While this option reduces storage space required in the index, it also means any query requiring positional information, such as PhraseQuery or SpanQuery subclasses will silently fail to find results.

        Specified by:
        setIndexOptions in interface Fieldable
      • toString

        public final String toString()
        Prints a Field for human consumption.
        Overrides:
        toString in class Object