public class Schema extends Object implements Iterable<SchemaField>, SchemaFieldProperties, Externalizable, Cloneable
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.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SCHEMA_NAME
The name of the default system schema.
|
static String |
PROP_CACHE_DYNAMIC_FIELD_LOOKUPS
property name for changing whether dynamic fields which are looked up are cached in the schema.
|
static String |
UID_FIELD
The reserved ID field for documents.
|
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 and Description |
---|
Schema() |
Schema(String name)
Construct a new Schema.
|
Modifier and Type | Method and Description |
---|---|
SchemaField |
addField(SchemaField field)
Adds
field to the schema. |
SchemaField |
addField(String fieldName)
Adds a new field by name to the schema.
|
void |
addUserDefinedField(UserDefinedFieldDef field) |
Schema |
clone() |
boolean |
containsField(String fieldName)
Determines if the schema contains a field with this name or name pattern for dynamic fields.
|
boolean |
containsProperty(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()
Returns
true if the schema contains user defined fields. |
boolean |
equals(Object other) |
String |
getDefaultSearchField()
The default field to search in if a field name is not otherwise specified.
|
SchemaField |
getField(String fieldName)
Gets a field by name, handling dynamic fields if necessary.
|
String |
getFieldNameByIndex(int index)
Returns the field name based on its index position.
|
String |
getName() |
int |
getNumberOfFields()
Retrieves the number of fields in this schema.
|
BaseTypesMap<String,String> |
getProperties()
Get all the properties associated with this schema.
|
String |
getProperty(String property)
Get a field property by name.
|
boolean |
getProperty(String property,
boolean defaultValue)
Get a field property by name with a default value.
|
double |
getProperty(String property,
double defaultValue)
Get a field property by name with a default value.
|
float |
getProperty(String property,
float defaultValue)
Get a field property by name with a default value.
|
int |
getProperty(String property,
int defaultValue)
Get a field property by name with a default value.
|
long |
getProperty(String property,
long defaultValue)
Get a field property by name with a default value.
|
String |
getProperty(String property,
String defaultValue)
Get a field property by name with a default value.
|
UserDefinedFieldDef |
getUserDefinedField(String name)
Get a user defined field by
name (case insensitive). |
List<UserDefinedFieldDef> |
getUserDefinedFields()
Get the user defined fields.
|
int |
hashCode() |
boolean |
isCacheDynamicFieldLookups() |
static boolean |
isDefaultSearchField(String field)
Return true if
field is the '*' field. |
Iterator<SchemaField> |
iterator() |
void |
readExternal(ObjectInput in) |
void |
removeField(String fieldName)
Remove a field from the schema.
|
void |
removeUserDefinedField(String name) |
String |
resolveFieldName(String field)
Resolve
field . |
void |
setCacheDynamicFieldLookups(boolean cacheDynamicFieldLookups) |
void |
setDefaultSearchField(String dsf) |
void |
setProperty(String property,
String value)
Sets a property on this schema.
|
void |
setUserDefinedFields(List<UserDefinedFieldDef> value)
Set the user defined fields.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final String DEFAULT_SCHEMA_NAME
public static final String UID_FIELD
public static final String PROP_CACHE_DYNAMIC_FIELD_LOOKUPS
public Schema()
public Schema(String name)
name
- the schema namepublic static boolean isDefaultSearchField(String field)
field
is the '*' field.public String resolveFieldName(String field)
field
.
If field
is null or "*", the default search field will be returned, otherwise field
will be returned
public SchemaField addField(String fieldName)
fieldName
- the name of the field to addpublic SchemaField addField(SchemaField field)
field
to the schema.field
- the schema fieldpublic void removeField(String fieldName)
fieldName
- the name of the field to remove1public SchemaField getField(String fieldName)
fieldName
- the field namepublic void addUserDefinedField(UserDefinedFieldDef field)
public void removeUserDefinedField(String name)
public UserDefinedFieldDef getUserDefinedField(String name)
name
(case insensitive).
Returns null
if user defined field does not exist.
public List<UserDefinedFieldDef> getUserDefinedFields()
public void setUserDefinedFields(List<UserDefinedFieldDef> value)
public String getFieldNameByIndex(int index)
index
- starting at 0public int getNumberOfFields()
public String getName()
public String getDefaultSearchField()
public void setDefaultSearchField(String dsf)
public Iterator<SchemaField> iterator()
iterator
in interface Iterable<SchemaField>
public boolean containsRealTimeFields()
public boolean containsUserDefinedFields()
true
if the schema contains user defined fields.public boolean containsField(String fieldName)
fieldName
- the field namepublic boolean containsProperty(String property)
public void setProperty(String property, String value)
property
- the property namevalue
- the property valuepublic String getProperty(String property, String defaultValue)
public boolean getProperty(String property, boolean defaultValue)
public int getProperty(String property, int defaultValue)
public long getProperty(String property, long defaultValue)
public float getProperty(String property, float defaultValue)
public double getProperty(String property, double defaultValue)
public BaseTypesMap<String,String> getProperties()
public boolean isCacheDynamicFieldLookups()
public void setCacheDynamicFieldLookups(boolean cacheDynamicFieldLookups)
public Schema clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.