|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.solr.schema.IndexSchema
public final class IndexSchema
IndexSchema
contains information about the valid fields in an index
and the types of those fields.
Field Summary | |
---|---|
static String |
DEFAULT_SCHEMA_FILE
|
Constructor Summary | |
---|---|
IndexSchema(SolrConfig solrConfig,
String name)
Deprecated. Use IndexSchema(SolrConfig, String, InputStream) instead. |
|
IndexSchema(SolrConfig solrConfig,
String name,
InputStream is)
Constructs a schema using the specified resource name and stream. |
Method Summary | |
---|---|
Analyzer |
getAnalyzer()
Returns the Analyzer used when indexing documents for this index |
SchemaField[] |
getCopyFields(String sourceField)
Get all copy fields, both the static and the dynamic ones. |
SchemaField[] |
getCopySources(String destField)
Get all copy fields, both the static and the dynamic ones. |
String |
getDefaultSearchFieldName()
Deprecated. use getSolrQueryParser().getField() |
SchemaField[] |
getDynamicFieldPrototypes()
|
FieldType |
getDynamicFieldType(String fieldName)
Returns the FieldType of the best matching dynamic field for the specified field name |
String |
getDynamicPattern(String fieldName)
|
SchemaField |
getField(String fieldName)
Returns the SchemaField that should be used for the specified field name |
SchemaField |
getFieldOrNull(String fieldName)
Returns the SchemaField that should be used for the specified field name, or null if none exists. |
Map<String,SchemaField> |
getFields()
Provides direct access to the Map containing all explicit (ie: non-dynamic) fields in the index, keyed on field name. |
List<SchemaField> |
getFieldsWithDefaultValue()
Provides direct access to the List containing all fields with a default value |
FieldType |
getFieldType(String fieldName)
Returns the FieldType for the specified field name. |
FieldType |
getFieldTypeNoEx(String fieldName)
Returns the FieldType for the specified field name. |
Map<String,FieldType> |
getFieldTypes()
Provides direct access to the Map containing all Field Types in the index, keyed on field type name. |
InputStream |
getInputStream()
Deprecated. Use getSolrConfig() and open a resource input stream
for getResourceName() instead. |
String |
getName()
Deprecated. Use getSchemaName() instead. |
Analyzer |
getQueryAnalyzer()
Returns the Analyzer used when searching this index |
String |
getQueryParserDefaultOperator()
Deprecated. use getSolrQueryParser().getDefaultOperator() |
Collection<SchemaField> |
getRequiredFields()
Provides direct access to the List containing all required fields. |
String |
getResourceName()
Gets the name of the resource used to instantiate this schema. |
String |
getSchemaFile()
Deprecated. Use getResourceName() instead. |
String |
getSchemaName()
Gets the name of the schema as specified in the schema resource. |
Similarity |
getSimilarity()
Returns the Similarity used for this index |
SimilarityFactory |
getSimilarityFactory()
Returns the SimilarityFactory used for this index |
SolrConfig |
getSolrConfig()
|
SolrQueryParser |
getSolrQueryParser(String defaultField)
A SolrQueryParser linked to this IndexSchema for field datatype information, and populated with default options from the <solrQueryParser> configuration for this IndexSchema. |
SchemaField |
getUniqueKeyField()
Unique Key field specified in the schema file |
Fieldable |
getUniqueKeyField(Document doc)
The raw (field type encoded) value of the Unique Key field for the specified Document |
boolean |
hasExplicitField(String fieldName)
Does the schema have the specified field defined explicitly, i.e. |
boolean |
isCopyFieldTarget(SchemaField f)
Check if a field is used as the destination of a copyField operation |
String |
printableUniqueKey(Document doc)
The printable value of the Unique Key field for the specified Document |
void |
refreshAnalyzers()
This will re-create the Analyzers. |
void |
registerCopyField(String source,
String dest)
NOTE: this function is not thread safe. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_SCHEMA_FILE
Constructor Detail |
---|
@Deprecated public IndexSchema(SolrConfig solrConfig, String name)
IndexSchema(SolrConfig, String, InputStream)
instead.
Config.openResource(java.lang.String)
public IndexSchema(SolrConfig solrConfig, String name, InputStream is)
By default, this follows the normal config path directory searching rules.
,
Config.openResource(java.lang.String)
Method Detail |
---|
public SolrConfig getSolrConfig()
public String getResourceName()
public String getSchemaName()
@Deprecated public InputStream getInputStream()
getSolrConfig()
and open a resource input stream
for getResourceName()
instead.
Config.openResource(java.lang.String)
@Deprecated public String getSchemaFile()
getResourceName()
instead.
@Deprecated public String getName()
getSchemaName()
instead.
public Map<String,SchemaField> getFields()
Modifying this Map (or any item in it) will affect the real schema
NOTE: this function is not thread safe. However, it is safe to use within the standard
inform( SolrCore core )
function for SolrCoreAware
classes.
Outside inform
, this could potentially throw a ConcurrentModificationException
public Map<String,FieldType> getFieldTypes()
Modifying this Map (or any item in it) will affect the real schema. However if you
make any modifications, be sure to call refreshAnalyzers()
to
update the Analyzers for the registered fields.
NOTE: this function is not thread safe. However, it is safe to use within the standard
inform( SolrCore core )
function for SolrCoreAware
classes.
Outside inform
, this could potentially throw a ConcurrentModificationException
public List<SchemaField> getFieldsWithDefaultValue()
public Collection<SchemaField> getRequiredFields()
public Similarity getSimilarity()
public SimilarityFactory getSimilarityFactory()
public Analyzer getAnalyzer()
This Analyzer is field (and dynamic field) name aware, and delegates to a field specific Analyzer based on the field type.
public Analyzer getQueryAnalyzer()
This Analyzer is field (and dynamic field) name aware, and delegates to a field specific Analyzer based on the field type.
public SolrQueryParser getSolrQueryParser(String defaultField)
defaultField
- if non-null overrides the schema default@Deprecated public String getDefaultSearchFieldName()
@Deprecated public String getQueryParserDefaultOperator()
public SchemaField getUniqueKeyField()
public Fieldable getUniqueKeyField(Document doc)
printableUniqueKey(org.apache.lucene.document.Document)
public String printableUniqueKey(Document doc)
public void refreshAnalyzers()
getFields()
, this function is required
to synch the internally cached field analyzers.
public void registerCopyField(String source, String dest)
NOTE: this function is not thread safe. However, it is safe to use within the standard
inform( SolrCore core )
function for SolrCoreAware
classes.
Outside inform
, this could potentially throw a ConcurrentModificationException
SolrCoreAware
public SchemaField[] getDynamicFieldPrototypes()
public String getDynamicPattern(String fieldName)
public boolean hasExplicitField(String fieldName)
fieldName
-
public SchemaField getFieldOrNull(String fieldName)
fieldName
- may be an explicitly defined field, or a name that
matches a dynamic field.getFieldType(java.lang.String)
public SchemaField getField(String fieldName)
fieldName
- may be an explicitly defined field, or a name that
matches a dynamic field.
org.apache.solr.common.SolrException
- if no such field existsgetFieldType(java.lang.String)
public FieldType getFieldType(String fieldName)
This method exists because it can be more efficient then
getField(java.lang.String)
for dynamic fields if a full SchemaField isn't needed.
fieldName
- may be an explicitly created field, or a name that
excercies a dynamic field.
org.apache.solr.common.SolrException
- if no such field existsgetField(String)
,
getFieldTypeNoEx(java.lang.String)
public FieldType getFieldTypeNoEx(String fieldName)
This method exists because it can be more efficient then
getField(java.lang.String)
for dynamic fields if a full SchemaField isn't needed.
fieldName
- may be an explicitly created field, or a name that
excercies a dynamic field.
getField(String)
,
getFieldTypeNoEx(java.lang.String)
public FieldType getDynamicFieldType(String fieldName)
fieldName
- may be an explicitly created field, or a name that
excercies a dynamic field.
org.apache.solr.common.SolrException
- if no such field existsgetField(String)
,
getFieldTypeNoEx(java.lang.String)
public SchemaField[] getCopySources(String destField)
destField
-
public SchemaField[] getCopyFields(String sourceField)
sourceField
-
public boolean isCopyFieldTarget(SchemaField f)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |