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.StringDEFAULT_SCHEMA_NAMEThe name of the default system schema.static java.lang.StringPROP_CACHE_DYNAMIC_FIELD_LOOKUPSDeprecated.static java.lang.StringUID_FIELDThe 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 SchemaFieldaddField(SchemaField field)Addsfieldto the schema.SchemaFieldaddField(java.lang.String fieldName)Adds a new field by name to the schema.voidaddUserDefinedField(UserDefinedFieldDef field)Schemaclone()booleancontainsField(java.lang.String fieldName)Determines if the schema contains a field with this name or name pattern for dynamic fields.booleancontainsProperty(java.lang.String property)Determine if the field has a given property.booleancontainsRealTimeFields()Returns true if one or more fields contain real time attributes.booleancontainsUserDefinedFields()Returnstrueif the schema contains user defined fields.booleanequals(java.lang.Object other)java.lang.StringgetDefaultSearchField()The default field to search in if a field name is not otherwise specified.SchemaFieldgetField(java.lang.String fieldName)Gets a field by name, handling dynamic fields if necessary.java.lang.StringgetFieldNameByIndex(int index)Returns the field name based on its index position.java.lang.StringgetName()intgetNumberOfFields()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.StringgetProperty(java.lang.String property)Get a field property by name.booleangetProperty(java.lang.String property, boolean defaultValue)Get a field property by name with a default value.doublegetProperty(java.lang.String property, double defaultValue)Get a field property by name with a default value.floatgetProperty(java.lang.String property, float defaultValue)Get a field property by name with a default value.intgetProperty(java.lang.String property, int defaultValue)Get a field property by name with a default value.longgetProperty(java.lang.String property, long defaultValue)Get a field property by name with a default value.java.lang.StringgetProperty(java.lang.String property, java.lang.String defaultValue)Get a field property by name with a default value.UserDefinedFieldDefgetUserDefinedField(java.lang.String name)Get a user defined field byname(case insensitive).java.util.List<UserDefinedFieldDef>getUserDefinedFields()Get the user defined fields.inthashCode()booleanisCacheDynamicFieldLookups()Deprecated.static booleanisDefaultSearchField(java.lang.String field)Return true iffieldis the '*' field.java.util.Iterator<SchemaField>iterator()voidreadExternal(java.io.ObjectInput in)voidremoveField(java.lang.String fieldName)Remove a field from the schema.voidremoveUserDefinedField(java.lang.String name)java.lang.StringresolveFieldName(java.lang.String field)Resolvefield.voidsetCacheDynamicFieldLookups(boolean value)Deprecated.voidsetDefaultSearchField(java.lang.String dsf)voidsetProperty(java.lang.String property, java.lang.String value)Sets a property on this schema.voidsetUserDefinedFields(java.util.List<UserDefinedFieldDef> value)Set the user defined fields.java.lang.StringtoString()voidwriteExternal(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 iffieldis the '*' field.
-
resolveFieldName
public java.lang.String resolveFieldName(java.lang.String field)
Resolvefield.If
fieldis null or "*", the default search field will be returned, otherwisefieldwill 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)
Addsfieldto 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
nullif 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:
iteratorin interfacejava.lang.Iterable<SchemaField>
-
containsRealTimeFields
public boolean containsRealTimeFields()
Returns true if one or more fields contain real time attributes.
-
containsUserDefinedFields
public boolean containsUserDefinedFields()
Returnstrueif 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:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
isCacheDynamicFieldLookups
@Deprecated public boolean isCacheDynamicFieldLookups()
Deprecated.
-
setCacheDynamicFieldLookups
@Deprecated public void setCacheDynamicFieldLookups(boolean value)
Deprecated.
-
clone
public Schema 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
-
-