Package com.attivio.sdk.schema
Class SchemaField
- java.lang.Object
-
- com.attivio.sdk.schema.SchemaField
-
- All Implemented Interfaces:
SchemaFieldProperties,java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<java.lang.String>
public class SchemaField extends java.lang.Object implements SchemaFieldProperties, java.lang.Iterable<java.lang.String>, java.io.Externalizable, java.lang.Cloneable
Represents a field in the schema.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSchemaField.LowerCaseModeEnum indicating the lowercase mode.static classSchemaField.TokenizeModeEnum indicating the tokenization mode.static classSchemaField.TypeAll the valid field types.
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringsuffix-
Fields inherited from interface com.attivio.sdk.schema.SchemaFieldProperties
ACRONYMS_MODE, CACHE_COMPRESSED, COLLATION_COUNTRY, COLLATION_DECOMPOSITION, COLLATION_LANGUAGE, COLLATION_STRENGTH, COLLATION_VARIANT, DATE_RESOLUTION, DECIMAL_PRECISION, DECIMAL_PRECISION_STEP, DECIMAL_SCALE, DEFAULT_ACRONYMS_MODE, DEFAULT_CACHE_COMPRESSED, DEFAULT_CACHE_POLICY, DEFAULT_DATE_RESOLUTION, DEFAULT_DECIMAL_PRECISION, DEFAULT_DECIMAL_PRECISION_STEP, DEFAULT_DECIMAL_SCALE, DEFAULT_FACET_CACHED, DEFAULT_FACET_DISTRIBUTED_MAX_NUM_BUCKETS, DEFAULT_FACET_DISTRIBUTED_MIN_CUTOFF, DEFAULT_FACET_ENUM, DEFAULT_FACET_ENUM_FACTOR, DEFAULT_FACET_ENUM_MAX_TERMS, DEFAULT_FACET_MAX_NUM_BUCKETS, DEFAULT_FACET_MAX_TERMS, DEFAULT_FACET_MIN_CUTOFF, DEFAULT_FACET_OUTLIER_FACTOR, DEFAULT_HIGHLIGHT_ENABLED, DEFAULT_HIGHLIGHT_FRAGMENT, DEFAULT_HIGHLIGHT_FRAGMENT_SIZE, DEFAULT_HIGHLIGHT_MERGE_FRAGMENTS, DEFAULT_HIGHLIGHT_NUM_FRAGMENTS, DEFAULT_HIGHLIGHT_SEPARATOR, DEFAULT_INDEX_MAX_LENGTH, DEFAULT_INDEX_MAX_TOKENS, DEFAULT_INDEX_OMIT_NORMS, DEFAULT_INDEX_PRECISION_STEP, DEFAULT_INDEX_RELEVANCY, DEFAULT_INDEX_TERM_VECTOR, DEFAULT_INDEX_TERM_VECTOR_OFFSETS, DEFAULT_INDEX_TERM_VECTOR_POSITIONS, DEFAULT_INDEX_TOKENIZER, DEFAULT_INDEX_WILDCARDS, DEFAULT_NATURAL_LANGUAGE, DEFAULT_SCOPE_XML_ATTRIBUTES, DEFAULT_STOPWORDS_MODE, DEFAULT_STORE_HIDDEN, DEFAULT_STORE_MAX_CHARS, DEFAULT_SYNONYMS_MODE, DEFAULT_WILDCARD_MAX_LENGTH, DEFAULT_WILDCARD_MAX_PHRASE_TERMS, DEFAULT_WILDCARD_MAX_TERMS, DEFAULT_WILDCARD_MODE, DEFAULT_WILDCARD_STEP, FACET_CACHE_POLICY, FACET_CACHED, FACET_DISTRIBUTED_MAX_NUM_BUCKETS, FACET_DISTRIBUTED_MIN_CUTOFF, FACET_ENUM, FACET_ENUM_FACTOR, FACET_ENUM_MAX_TERMS, FACET_MAX_DISCRETE_BUCKETS, FACET_MAX_NUM_BUCKETS, FACET_MAX_TERMS, FACET_MIN_CUTOFF, FACET_OUTLIER_FACTOR, HIGHLIGHT_ENABLED, HIGHLIGHT_FALLBACK_FIELD, HIGHLIGHT_FRAGMENT, HIGHLIGHT_FRAGMENT_SCOPE, HIGHLIGHT_FRAGMENT_SIZE, HIGHLIGHT_MERGE_FRAGMENTS, HIGHLIGHT_METHOD, HIGHLIGHT_NUM_FRAGMENTS, HIGHLIGHT_SEPARATOR, HIGHLIGHT_WHITELIST, INDEX_MAX_LENGTH, INDEX_MAX_TOKENS, INDEX_OMIT_NORMS, INDEX_PRECISION_STEP, INDEX_RELEVANCY, INDEX_TERM_VECTOR, INDEX_TERM_VECTOR_OFFSETS, INDEX_TERM_VECTOR_POSITIONS, INDEX_TOKENIZER, INDEX_WILDCARDS, JOIN_CACHE_POLICY, NATURAL_LANGUAGE, SCOPE_XML_ATTRIBUTES, SPELLCHECK_FIELD, STOPWORDS_MODE, STORE_HIDDEN, STORE_MAX_CHARS, SYNONYMS_MODE, WILDCARD_MAX_LENGTH, WILDCARD_MAX_PHRASE_TERMS, WILDCARD_MAX_TERMS, WILDCARD_MODE, WILDCARD_STEP
-
-
Constructor Summary
Constructors Modifier Constructor Description SchemaField()SchemaField(java.lang.String fieldName)Construct a new String SchemaField.SchemaField(java.lang.String fieldName, SchemaField.Type fieldType)Construct a new typed SchemaField.protectedSchemaField(java.lang.String name, SchemaField.Type type, boolean internal)Construct a new SchemaField.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddIncludeField(java.lang.String... fName)Add include field(s).voidaddProperty(java.lang.String propName, java.lang.String propValue)Adds a property to the field.static voidcheckFieldName(java.lang.String name)SchemaFieldclone()booleancontainsProperty(java.lang.String property)Determine if the field has a given property.booleanequals(java.lang.Object other)java.lang.StringgetDefaultValue()Gets the default value for this SchemaField.java.lang.StringgetDisplayName()Gets the display name for this SchemaField.intgetIncludedFieldCount()Get the number of include fields.SchemaField.LowerCaseModegetLowerCaseMode()Get the lower case mode of this field.intgetMaxTokens()java.lang.StringgetName()Gets this SchemaField's name.java.util.Map<java.lang.String,java.lang.String>getProperties()Properties configured for this field.java.lang.StringgetProperty(java.lang.String property)Get a field property by name.booleangetProperty(java.lang.String property, boolean defaultVal)Get a field property by name with a default value.doublegetProperty(java.lang.String property, double pdefaultValue)Get a field property by name with a default value.floatgetProperty(java.lang.String property, float pdefaultValue)Get a field property by name with a default value.intgetProperty(java.lang.String property, int pdefaultValue)Get a field property by name with a default value.longgetProperty(java.lang.String property, long pdefaultValue)Get a field property by name with a default value.java.lang.StringgetProperty(java.lang.String property, java.lang.String defaultVal)Get a field property by name with a default value.static SchemaField.TypegetSchemaFieldType(java.lang.Object o)Gets the data type for a given valueSchemaField.TokenizeModegetTokenizeMode()Get the tokenize mode of this field.java.lang.StringgetTokenizerName()Get the name of the tokenizer for thisSchemaField.SchemaField.TypegetType()Gets the Type of this SchemaField.inthashCode()booleanisDynamic()Gets if this SchemaField is dynamic.booleanisFacet()Gets if this SchemaField should be facetable.booleanisHighlight()Gets if highlighting is enabled for this field.booleanisIndexed()Gets if this SchemaField should be indexed.booleanisLowerCase()trueif this field should be indexed in lower case.booleanisMultiValue()Get if this field can support multiple field values per document.booleanisNaturalLanguage()trueiffieldcan be used for "natural language" processing.booleanisRealTime()Returns true if this SchemaField has real time attributes.booleanisSameField(java.lang.String fieldName)Determines if the field names are the same or a variant based on dynamic field name rules.booleanisSingleValue()Get if this field is single valued.booleanisSort()Gets if this SchemaField should support sorting.booleanisStored()Gets if this SchemaField should be stored.booleanisTokenized()trueif this field should be tokenized during ingestion.static booleanisValidDynamicField(java.lang.String name)Returnstrueifnameis a legal dynamic field name.static booleanisValidStaticField(java.lang.String name)Returnstrueifnameis a legal field name.java.util.Iterator<java.lang.String>iterator()Get the included field names.voidreadExternal(java.io.ObjectInput in)voidsetDefaultValue(java.lang.String defaultValue)Sets the default value for this SchemaField.voidsetDisplayName(java.lang.String displayName)Sets the display name for this SchemaField.voidsetDynamic(boolean value)Sets if this SchemaField is dynamic.voidsetHighlight(boolean value)Gets if highlighting is enabled for this field.voidsetIndexed(boolean indexed)Sets if this SchemaField should be indexed.voidsetLowerCase(boolean value)voidsetLowerCaseMode(SchemaField.LowerCaseMode mode)Set the lower case mode of this field.voidsetMaxTokens(int maxTokens)voidsetMultiValue(boolean value)Set if this field can support multiple field values per document.voidsetName(java.lang.String value)Sets this SchemaField's name.voidsetProperties(java.util.Map<java.lang.String,java.lang.String> features)Sets the properties for this SchemaField.voidsetRealTime(boolean value)voidsetSingleValue(boolean value)Set if this field is single valued.voidsetSort(boolean value)Sets if this SchemaField should support sorting.voidsetStored(boolean value)Sets if this SchemaField should be stored.voidsetTokenized(boolean value)voidsetTokenizeMode(SchemaField.TokenizeMode mode)Set the tokenize mode of this field.voidsetType(SchemaField.Type type)Sets the Type of this SchemaField.voidwriteExternal(java.io.ObjectOutput out)protected voidwriteExternal(java.io.ObjectOutput out, boolean standalone)
-
-
-
Constructor Detail
-
SchemaField
public SchemaField()
-
SchemaField
public SchemaField(java.lang.String fieldName)
Construct a new String SchemaField.- Parameters:
fieldName- the field name
-
SchemaField
public SchemaField(java.lang.String fieldName, SchemaField.Type fieldType)Construct a new typed SchemaField.- Parameters:
fieldName- the field namefieldType- the field type
-
SchemaField
protected SchemaField(java.lang.String name, SchemaField.Type type, boolean internal)Construct a new SchemaField.If
internalis true, field name will not be validated.
-
-
Method Detail
-
checkFieldName
public static final void checkFieldName(java.lang.String name)
-
isNaturalLanguage
public boolean isNaturalLanguage()
trueiffieldcan be used for "natural language" processing.
-
getTokenizerName
public java.lang.String getTokenizerName()
Get the name of the tokenizer for thisSchemaField.
-
isHighlight
public boolean isHighlight()
Gets if highlighting is enabled for this field.
-
setHighlight
public void setHighlight(boolean value)
Gets if highlighting is enabled for this field.
-
isSingleValue
public boolean isSingleValue()
Get if this field is single valued.
-
setSingleValue
public void setSingleValue(boolean value)
Set if this field is single valued.WARNING: changing this setting to true requires reindexing to ensure no documents contain multiple values for a field.
-
isMultiValue
public boolean isMultiValue()
Get if this field can support multiple field values per document.
-
setMultiValue
public void setMultiValue(boolean value)
Set if this field can support multiple field values per document.WARNING: changing this setting to false requires reindexing to ensure no documents contain multiple values for a field.
-
isRealTime
public boolean isRealTime()
Returns true if this SchemaField has real time attributes.
-
setRealTime
public void setRealTime(boolean value)
-
getTokenizeMode
public SchemaField.TokenizeMode getTokenizeMode()
Get the tokenize mode of this field.
-
setTokenizeMode
public void setTokenizeMode(SchemaField.TokenizeMode mode)
Set the tokenize mode of this field.
-
isTokenized
public boolean isTokenized()
trueif this field should be tokenized during ingestion.
-
setTokenized
public void setTokenized(boolean value)
-
getLowerCaseMode
public SchemaField.LowerCaseMode getLowerCaseMode()
Get the lower case mode of this field.
-
setLowerCaseMode
public void setLowerCaseMode(SchemaField.LowerCaseMode mode)
Set the lower case mode of this field.
-
setLowerCase
public void setLowerCase(boolean value)
-
isLowerCase
public boolean isLowerCase()
trueif this field should be indexed in lower case.
-
iterator
public java.util.Iterator<java.lang.String> iterator()
Get the included field names.- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.String>
-
addIncludeField
public void addIncludeField(java.lang.String... fName)
Add include field(s).
-
getIncludedFieldCount
public int getIncludedFieldCount()
Get the number of include fields.
-
getName
public java.lang.String getName()
Gets this SchemaField's name.
-
setName
public void setName(java.lang.String value)
Sets this SchemaField's name.
-
isIndexed
public boolean isIndexed()
Gets if this SchemaField should be indexed.
-
setIndexed
public void setIndexed(boolean indexed)
Sets if this SchemaField should be indexed.
-
isFacet
public boolean isFacet()
Gets if this SchemaField should be facetable.
-
isStored
public boolean isStored()
Gets if this SchemaField should be stored.
-
setStored
public void setStored(boolean value)
Sets if this SchemaField should be stored.
-
isSort
public boolean isSort()
Gets if this SchemaField should support sorting.
-
setSort
public void setSort(boolean value)
Sets if this SchemaField should support sorting.
-
getType
public SchemaField.Type getType()
Gets the Type of this SchemaField.
-
setType
public void setType(SchemaField.Type type)
Sets the Type of this SchemaField.
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()
Properties configured for this field.
-
setProperties
public void setProperties(java.util.Map<java.lang.String,java.lang.String> features)
Sets the properties for this SchemaField.
-
addProperty
public void addProperty(java.lang.String propName, java.lang.String propValue)Adds a property to the field.- Parameters:
propName- the property namepropValue- the property value
-
getDefaultValue
public java.lang.String getDefaultValue()
Gets the default value for this SchemaField.
-
setDefaultValue
public void setDefaultValue(java.lang.String defaultValue)
Sets the default value for this SchemaField.
-
containsProperty
public boolean containsProperty(java.lang.String property)
Determine if the field has a given property.
-
getProperty
public java.lang.String getProperty(java.lang.String property)
Get a field property by name.
-
getProperty
public java.lang.String getProperty(java.lang.String property, java.lang.String defaultVal)Get a field property by name with a default value.
-
getProperty
public boolean getProperty(java.lang.String property, boolean defaultVal)Get a field property by name with a default value.
-
getProperty
public int getProperty(java.lang.String property, int pdefaultValue)Get a field property by name with a default value.
-
getProperty
public long getProperty(java.lang.String property, long pdefaultValue)Get a field property by name with a default value.
-
getProperty
public float getProperty(java.lang.String property, float pdefaultValue)Get a field property by name with a default value.
-
getProperty
public double getProperty(java.lang.String property, double pdefaultValue)Get a field property by name with a default value.
-
isDynamic
public boolean isDynamic()
Gets if this SchemaField is dynamic.
-
setDynamic
public void setDynamic(boolean value)
Sets if this SchemaField is dynamic.
-
isSameField
public boolean isSameField(java.lang.String fieldName)
Determines if the field names are the same or a variant based on dynamic field name rules.
-
getDisplayName
public java.lang.String getDisplayName()
Gets the display name for this SchemaField.
-
setDisplayName
public void setDisplayName(java.lang.String displayName)
Sets the display name for this SchemaField.
-
getSchemaFieldType
public static SchemaField.Type getSchemaFieldType(java.lang.Object o)
Gets the data type for a given value- Parameters:
o- the value- Returns:
- the type
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
isValidStaticField
public static boolean isValidStaticField(java.lang.String name)
Returnstrueifnameis a legal field name.
-
isValidDynamicField
public static boolean isValidDynamicField(java.lang.String name)
Returnstrueifnameis a legal dynamic field name.
-
getMaxTokens
public int getMaxTokens()
-
setMaxTokens
public void setMaxTokens(int maxTokens)
-
clone
public SchemaField clone()
- Overrides:
clonein classjava.lang.Object
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
writeExternal
protected void writeExternal(java.io.ObjectOutput out, boolean standalone) throws java.io.IOException- Throws:
java.io.IOException
-
-