Package com.attivio.sdk.schema
Class Schema
- java.lang.Object
-
- com.attivio.sdk.schema.Schema
-
- All Implemented Interfaces:
SchemaFieldProperties
,java.io.Externalizable
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<SchemaField>
public class Schema extends java.lang.Object implements java.lang.Iterable<SchemaField>, SchemaFieldProperties, java.io.Externalizable, java.lang.Cloneable
Contains all information about a particular data set.A schema informs various transformers, services and any other interested parties (clients for example) about the underlying data structure of the information available.
For example a transformer might look at the fields in the schema and convert fields to various data types based on their field types as a means of content checking.
They might also use properties stored on fields to enable or disable certain features like linguistics.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_SCHEMA_NAME
The name of the default system schema.static java.lang.String
PROP_CACHE_DYNAMIC_FIELD_LOOKUPS
Deprecated.static java.lang.String
UID_FIELD
The reserved ID field for documents.-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SchemaField
addField(SchemaField field)
Addsfield
to the schema.SchemaField
addField(java.lang.String fieldName)
Adds a new field by name to the schema.void
addUserDefinedField(UserDefinedFieldDef field)
Schema
clone()
boolean
containsField(java.lang.String fieldName)
Determines if the schema contains a field with this name or name pattern for dynamic fields.boolean
containsProperty(java.lang.String property)
Determine if the field has a given property.boolean
containsRealTimeFields()
Returns true if one or more fields contain real time attributes.boolean
containsUserDefinedFields()
Returnstrue
if the schema contains user defined fields.boolean
equals(java.lang.Object other)
java.lang.String
getDefaultSearchField()
The default field to search in if a field name is not otherwise specified.SchemaField
getField(java.lang.String fieldName)
Gets a field by name, handling dynamic fields if necessary.java.lang.String
getFieldNameByIndex(int index)
Returns the field name based on its index position.java.lang.String
getName()
int
getNumberOfFields()
Retrieves the number of fields in this schema.BaseTypesMap<java.lang.String,java.lang.String>
getProperties()
Get all the properties associated with this schema.java.lang.String
getProperty(java.lang.String property)
Get a field property by name.boolean
getProperty(java.lang.String property, boolean defaultValue)
Get a field property by name with a default value.double
getProperty(java.lang.String property, double defaultValue)
Get a field property by name with a default value.float
getProperty(java.lang.String property, float defaultValue)
Get a field property by name with a default value.int
getProperty(java.lang.String property, int defaultValue)
Get a field property by name with a default value.long
getProperty(java.lang.String property, long defaultValue)
Get a field property by name with a default value.java.lang.String
getProperty(java.lang.String property, java.lang.String defaultValue)
Get a field property by name with a default value.UserDefinedFieldDef
getUserDefinedField(java.lang.String name)
Get a user defined field byname
(case insensitive).java.util.List<UserDefinedFieldDef>
getUserDefinedFields()
Get the user defined fields.int
hashCode()
boolean
isCacheDynamicFieldLookups()
Deprecated.static boolean
isDefaultSearchField(java.lang.String field)
Return true iffield
is the '*' field.java.util.Iterator<SchemaField>
iterator()
void
readExternal(java.io.ObjectInput in)
void
removeField(java.lang.String fieldName)
Remove a field from the schema.void
removeUserDefinedField(java.lang.String name)
java.lang.String
resolveFieldName(java.lang.String field)
Resolvefield
.void
setCacheDynamicFieldLookups(boolean value)
Deprecated.void
setDefaultSearchField(java.lang.String dsf)
void
setProperty(java.lang.String property, java.lang.String value)
Sets a property on this schema.void
setUserDefinedFields(java.util.List<UserDefinedFieldDef> value)
Set the user defined fields.java.lang.String
toString()
void
writeExternal(java.io.ObjectOutput out)
-
-
-
Field Detail
-
DEFAULT_SCHEMA_NAME
public static final java.lang.String DEFAULT_SCHEMA_NAME
The name of the default system schema.- See Also:
- Constant Field Values
-
UID_FIELD
public static final java.lang.String UID_FIELD
The reserved ID field for documents.- See Also:
- Constant Field Values
-
PROP_CACHE_DYNAMIC_FIELD_LOOKUPS
@Deprecated public static final java.lang.String PROP_CACHE_DYNAMIC_FIELD_LOOKUPS
Deprecated.property name for changing whether dynamic fields which are looked up are cached in the schema.- See Also:
- Constant Field Values
-
-
Method Detail
-
isDefaultSearchField
public static boolean isDefaultSearchField(java.lang.String field)
Return true iffield
is the '*' field.
-
resolveFieldName
public java.lang.String resolveFieldName(java.lang.String field)
Resolvefield
.If
field
is null or "*", the default search field will be returned, otherwisefield
will be returned.
-
addField
public SchemaField addField(java.lang.String fieldName)
Adds a new field by name to the schema.- Parameters:
fieldName
- the name of the field to add- Returns:
- the newly created Field with default configuration
-
addField
public SchemaField addField(SchemaField field)
Addsfield
to the schema.- Parameters:
field
- the schema field
-
removeField
public void removeField(java.lang.String fieldName)
Remove a field from the schema. Does nothing if no field with the given name exists in the schema.- Parameters:
fieldName
- the name of the field to remove1
-
getField
public SchemaField getField(java.lang.String fieldName)
Gets a field by name, handling dynamic fields if necessary.- Parameters:
fieldName
- the field name- Returns:
- null if no field or the dynamic field that matches this name
-
addUserDefinedField
public void addUserDefinedField(UserDefinedFieldDef field)
-
removeUserDefinedField
public void removeUserDefinedField(java.lang.String name)
-
getUserDefinedField
public UserDefinedFieldDef getUserDefinedField(java.lang.String name)
Get a user defined field byname
(case insensitive).Returns
null
if user defined field does not exist.
-
getUserDefinedFields
public java.util.List<UserDefinedFieldDef> getUserDefinedFields()
Get the user defined fields.
-
setUserDefinedFields
public void setUserDefinedFields(java.util.List<UserDefinedFieldDef> value)
Set the user defined fields.
-
getFieldNameByIndex
public java.lang.String getFieldNameByIndex(int index)
Returns the field name based on its index position.- Parameters:
index
- starting at 0- Returns:
- the schema field found or null if no schema field at the supplied index
-
getNumberOfFields
public int getNumberOfFields()
Retrieves the number of fields in this schema.- Returns:
- the number of fields
-
getName
public java.lang.String getName()
-
getDefaultSearchField
public java.lang.String getDefaultSearchField()
The default field to search in if a field name is not otherwise specified.
-
setDefaultSearchField
public void setDefaultSearchField(java.lang.String dsf)
-
iterator
public java.util.Iterator<SchemaField> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<SchemaField>
-
containsRealTimeFields
public boolean containsRealTimeFields()
Returns true if one or more fields contain real time attributes.
-
containsUserDefinedFields
public boolean containsUserDefinedFields()
Returnstrue
if the schema contains user defined fields.
-
containsField
public boolean containsField(java.lang.String fieldName)
Determines if the schema contains a field with this name or name pattern for dynamic fields.- Parameters:
fieldName
- the field name- Returns:
- true if the schema has the field with this name
-
containsProperty
public boolean containsProperty(java.lang.String property)
Determine if the field has a given property.
-
setProperty
public void setProperty(java.lang.String property, java.lang.String value)
Sets a property on this schema.- Parameters:
property
- the property namevalue
- the property value
-
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 defaultValue)
Get a field property by name with a default value.
-
getProperty
public boolean getProperty(java.lang.String property, boolean defaultValue)
Get a field property by name with a default value.
-
getProperty
public int getProperty(java.lang.String property, int defaultValue)
Get a field property by name with a default value.
-
getProperty
public long getProperty(java.lang.String property, long defaultValue)
Get a field property by name with a default value.
-
getProperty
public float getProperty(java.lang.String property, float defaultValue)
Get a field property by name with a default value.
-
getProperty
public double getProperty(java.lang.String property, double defaultValue)
Get a field property by name with a default value.
-
getProperties
public BaseTypesMap<java.lang.String,java.lang.String> getProperties()
Get all the properties associated with this schema.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
isCacheDynamicFieldLookups
@Deprecated public boolean isCacheDynamicFieldLookups()
Deprecated.
-
setCacheDynamicFieldLookups
@Deprecated public void setCacheDynamicFieldLookups(boolean value)
Deprecated.
-
clone
public Schema 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
-
-