Class Attribute

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public final class Attribute
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    A search-time document attribute (per-document in-memory value). This belongs to the field defining the attribute.
    Author:
    bratseth
    See Also:
    Serialized Form
    • Constructor Detail

      • Attribute

        public Attribute​(java.lang.String name,
                         com.yahoo.document.DataType fieldType)
        Creates an attribute with default settings
      • Attribute

        public Attribute​(java.lang.String name,
                         Attribute.Type type,
                         Attribute.CollectionType collectionType,
                         java.util.Optional<com.yahoo.tensor.TensorType> tensorType,
                         java.util.Optional<com.yahoo.document.StructuredDataType> referenceDocumentType)
    • Method Detail

      • convertToArray

        public Attribute convertToArray()
      • isPrefetch

        public boolean isPrefetch()

        Returns whether this attribute should be included in the "attributeprefetch" summary which is returned to the Qrs by prefetchAttributes, used by blending, uniquing etc.

        Single value attributes are prefetched by default if summary is true. Multi value attributes are not.

      • getPrefetchValue

        public java.lang.Boolean getPrefetchValue()
        Returns the prefetch value of this, null if the default is used.
      • isRemoveIfZero

        public boolean isRemoveIfZero()
      • isCreateIfNonExistent

        public boolean isCreateIfNonExistent()
      • isEnabledBitVectors

        public boolean isEnabledBitVectors()
      • isEnabledOnlyBitVector

        public boolean isEnabledOnlyBitVector()
      • isFastSearch

        public boolean isFastSearch()
      • isFastAccess

        public boolean isFastAccess()
      • isHuge

        public boolean isHuge()
      • isPosition

        public boolean isPosition()
      • isMutable

        public boolean isMutable()
      • arity

        public int arity()
      • lowerBound

        public long lowerBound()
      • upperBound

        public long upperBound()
      • densePostingListThreshold

        public double densePostingListThreshold()
      • tensorType

        public java.util.Optional<com.yahoo.tensor.TensorType> tensorType()
      • referenceDocumentType

        public java.util.Optional<com.yahoo.document.StructuredDataType> referenceDocumentType()
      • hnswIndexParams

        public java.util.Optional<HnswIndexParams> hnswIndexParams()
      • getSorting

        public Sorting getSorting()
      • setRemoveIfZero

        public void setRemoveIfZero​(boolean remove)
      • setCreateIfNonExistent

        public void setCreateIfNonExistent​(boolean create)
      • setPrefetch

        public void setPrefetch​(java.lang.Boolean prefetch)
        Sets whether this should be included in the "attributeprefetch" document summary. True or false to override default, null to use default
      • setEnableBitVectors

        public void setEnableBitVectors​(boolean enableBitVectors)
      • setEnableOnlyBitVector

        public void setEnableOnlyBitVector​(boolean enableOnlyBitVector)
      • setFastSearch

        public void setFastSearch​(boolean fastSearch)
      • setHuge

        public void setHuge​(boolean huge)
      • setFastAccess

        public void setFastAccess​(boolean fastAccess)
      • setPosition

        public void setPosition​(boolean position)
      • setMutable

        public void setMutable​(boolean mutable)
      • setArity

        public void setArity​(int arity)
      • setLowerBound

        public void setLowerBound​(long lowerBound)
      • setUpperBound

        public void setUpperBound​(long upperBound)
      • setDensePostingListThreshold

        public void setDensePostingListThreshold​(double threshold)
      • setTensorType

        public void setTensorType​(com.yahoo.tensor.TensorType tensorType)
      • setHnswIndexParams

        public void setHnswIndexParams​(HnswIndexParams params)
      • getName

        public java.lang.String getName()
      • setName

        public void setName​(java.lang.String name)
      • convertDataType

        public static Attribute.Type convertDataType​(com.yahoo.document.DataType fieldType)
        Converts to the right attribute type from a field datatype
      • getDataType

        public com.yahoo.document.DataType getDataType()
      • 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
      • isCompatible

        public boolean isCompatible​(Attribute other)
        Returns whether these attributes describes the same entity, even if they have different names
      • clone

        public Attribute clone()
        Overrides:
        clone in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getAliases

        public java.util.Set<java.lang.String> getAliases()