Class Attribute
- java.lang.Object
-
- com.yahoo.searchdefinition.document.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Attribute.CollectionType
The attribute collection type enumerationstatic class
Attribute.DistanceMetric
static class
Attribute.Type
The attribute type enumeration
-
Field Summary
Fields Modifier and Type Field Description static Attribute.DistanceMetric
DEFAULT_DISTANCE_METRIC
-
Constructor Summary
Constructors Constructor Description Attribute(java.lang.String name, com.yahoo.document.DataType fieldType)
Creates an attribute with default settingsAttribute(java.lang.String name, Attribute.Type type, Attribute.CollectionType collectionType)
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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
arity()
Attribute
clone()
static Attribute.Type
convertDataType(com.yahoo.document.DataType fieldType)
Converts to the right attribute type from a field datatypeAttribute
convertToArray()
double
densePostingListThreshold()
Attribute.DistanceMetric
distanceMetric()
boolean
equals(java.lang.Object object)
java.util.Set<java.lang.String>
getAliases()
Attribute.CollectionType
getCollectionType()
com.yahoo.document.DataType
getDataType()
java.lang.String
getName()
java.lang.Boolean
getPrefetchValue()
Returns the prefetch value of this, null if the default is used.Sorting
getSorting()
Attribute.Type
getType()
int
hashCode()
java.util.Optional<HnswIndexParams>
hnswIndexParams()
boolean
isCompatible(Attribute other)
Returns whether these attributes describes the same entity, even if they have different namesboolean
isCreateIfNonExistent()
boolean
isEnabledBitVectors()
boolean
isEnabledOnlyBitVector()
boolean
isFastAccess()
boolean
isFastSearch()
boolean
isHuge()
boolean
isMutable()
boolean
isPosition()
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.boolean
isRemoveIfZero()
long
lowerBound()
java.util.Optional<com.yahoo.document.StructuredDataType>
referenceDocumentType()
void
setArity(int arity)
void
setCollectionType(Attribute.CollectionType type)
void
setCreateIfNonExistent(boolean create)
void
setDensePostingListThreshold(double threshold)
void
setDistanceMetric(Attribute.DistanceMetric metric)
void
setEnableBitVectors(boolean enableBitVectors)
void
setEnableOnlyBitVector(boolean enableOnlyBitVector)
void
setFastAccess(boolean fastAccess)
void
setFastSearch(boolean fastSearch)
void
setHnswIndexParams(HnswIndexParams params)
void
setHuge(boolean huge)
void
setLowerBound(long lowerBound)
void
setMutable(boolean mutable)
void
setName(java.lang.String name)
void
setPosition(boolean position)
void
setPrefetch(java.lang.Boolean prefetch)
Sets whether this should be included in the "attributeprefetch" document summary.void
setRemoveIfZero(boolean remove)
void
setTensorType(com.yahoo.tensor.TensorType tensorType)
void
setUpperBound(long upperBound)
java.util.Optional<com.yahoo.tensor.TensorType>
tensorType()
java.lang.String
toString()
long
upperBound()
-
-
-
Field Detail
-
DEFAULT_DISTANCE_METRIC
public static final Attribute.DistanceMetric DEFAULT_DISTANCE_METRIC
-
-
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)
-
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()
-
distanceMetric
public Attribute.DistanceMetric distanceMetric()
-
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)
-
setDistanceMetric
public void setDistanceMetric(Attribute.DistanceMetric metric)
-
setHnswIndexParams
public void setHnswIndexParams(HnswIndexParams params)
-
getName
public java.lang.String getName()
-
getType
public Attribute.Type getType()
-
getCollectionType
public Attribute.CollectionType getCollectionType()
-
setName
public void setName(java.lang.String name)
-
setCollectionType
public void setCollectionType(Attribute.CollectionType type)
-
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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.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 classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getAliases
public java.util.Set<java.lang.String> getAliases()
-
-