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 class
SchemaField.LowerCaseMode
Enum indicating the lowercase mode.static class
SchemaField.TokenizeMode
Enum indicating the tokenization mode.static class
SchemaField.Type
All the valid field types.
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
suffix
-
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.protected
SchemaField(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 void
addIncludeField(java.lang.String... fName)
Add include field(s).void
addProperty(java.lang.String propName, java.lang.String propValue)
Adds a property to the field.static void
checkFieldName(java.lang.String name)
SchemaField
clone()
boolean
containsProperty(java.lang.String property)
Determine if the field has a given property.boolean
equals(java.lang.Object other)
java.lang.String
getDefaultValue()
Gets the default value for this SchemaField.java.lang.String
getDisplayName()
Gets the display name for this SchemaField.int
getIncludedFieldCount()
Get the number of include fields.SchemaField.LowerCaseMode
getLowerCaseMode()
Get the lower case mode of this field.int
getMaxTokens()
java.lang.String
getName()
Gets this SchemaField's name.java.util.Map<java.lang.String,java.lang.String>
getProperties()
Properties configured for this field.java.lang.String
getProperty(java.lang.String property)
Get a field property by name.boolean
getProperty(java.lang.String property, boolean defaultVal)
Get a field property by name with a default value.double
getProperty(java.lang.String property, double pdefaultValue)
Get a field property by name with a default value.float
getProperty(java.lang.String property, float pdefaultValue)
Get a field property by name with a default value.int
getProperty(java.lang.String property, int pdefaultValue)
Get a field property by name with a default value.long
getProperty(java.lang.String property, long pdefaultValue)
Get a field property by name with a default value.java.lang.String
getProperty(java.lang.String property, java.lang.String defaultVal)
Get a field property by name with a default value.static SchemaField.Type
getSchemaFieldType(java.lang.Object o)
Gets the data type for a given valueSchemaField.TokenizeMode
getTokenizeMode()
Get the tokenize mode of this field.java.lang.String
getTokenizerName()
Get the name of the tokenizer for thisSchemaField
.SchemaField.Type
getType()
Gets the Type of this SchemaField.int
hashCode()
boolean
isDynamic()
Gets if this SchemaField is dynamic.boolean
isFacet()
Gets if this SchemaField should be facetable.boolean
isHighlight()
Gets if highlighting is enabled for this field.boolean
isIndexed()
Gets if this SchemaField should be indexed.boolean
isLowerCase()
true
if this field should be indexed in lower case.boolean
isMultiValue()
Get if this field can support multiple field values per document.boolean
isNaturalLanguage()
true
iffield
can be used for "natural language" processing.boolean
isRealTime()
Returns true if this SchemaField has real time attributes.boolean
isSameField(java.lang.String fieldName)
Determines if the field names are the same or a variant based on dynamic field name rules.boolean
isSingleValue()
Get if this field is single valued.boolean
isSort()
Gets if this SchemaField should support sorting.boolean
isStored()
Gets if this SchemaField should be stored.boolean
isTokenized()
true
if this field should be tokenized during ingestion.static boolean
isValidDynamicField(java.lang.String name)
Returnstrue
ifname
is a legal dynamic field name.static boolean
isValidStaticField(java.lang.String name)
Returnstrue
ifname
is a legal field name.java.util.Iterator<java.lang.String>
iterator()
Get the included field names.void
readExternal(java.io.ObjectInput in)
void
setDefaultValue(java.lang.String defaultValue)
Sets the default value for this SchemaField.void
setDisplayName(java.lang.String displayName)
Sets the display name for this SchemaField.void
setDynamic(boolean value)
Sets if this SchemaField is dynamic.void
setHighlight(boolean value)
Gets if highlighting is enabled for this field.void
setIndexed(boolean indexed)
Sets if this SchemaField should be indexed.void
setLowerCase(boolean value)
void
setLowerCaseMode(SchemaField.LowerCaseMode mode)
Set the lower case mode of this field.void
setMaxTokens(int maxTokens)
void
setMultiValue(boolean value)
Set if this field can support multiple field values per document.void
setName(java.lang.String value)
Sets this SchemaField's name.void
setProperties(java.util.Map<java.lang.String,java.lang.String> features)
Sets the properties for this SchemaField.void
setRealTime(boolean value)
void
setSingleValue(boolean value)
Set if this field is single valued.void
setSort(boolean value)
Sets if this SchemaField should support sorting.void
setStored(boolean value)
Sets if this SchemaField should be stored.void
setTokenized(boolean value)
void
setTokenizeMode(SchemaField.TokenizeMode mode)
Set the tokenize mode of this field.void
setType(SchemaField.Type type)
Sets the Type of this SchemaField.void
writeExternal(java.io.ObjectOutput out)
protected void
writeExternal(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
internal
is true, field name will not be validated.
-
-
Method Detail
-
checkFieldName
public static final void checkFieldName(java.lang.String name)
-
isNaturalLanguage
public boolean isNaturalLanguage()
true
iffield
can 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()
true
if 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()
true
if this field should be indexed in lower case.
-
iterator
public java.util.Iterator<java.lang.String> iterator()
Get the included field names.- Specified by:
iterator
in 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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
isValidStaticField
public static boolean isValidStaticField(java.lang.String name)
Returnstrue
ifname
is a legal field name.
-
isValidDynamicField
public static boolean isValidDynamicField(java.lang.String name)
Returnstrue
ifname
is a legal dynamic field name.
-
getMaxTokens
public int getMaxTokens()
-
setMaxTokens
public void setMaxTokens(int maxTokens)
-
clone
public SchemaField clone()
- Overrides:
clone
in classjava.lang.Object
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in 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
-
-