You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Ivan Provalov (JIRA)" <ji...@apache.org> on 2016/11/04 16:25:59 UTC
[jira] [Created] (SOLR-9730) IndexSchema Dynamic Field Definition
Caching
Ivan Provalov created SOLR-9730:
-----------------------------------
Summary: IndexSchema Dynamic Field Definition Caching
Key: SOLR-9730
URL: https://issues.apache.org/jira/browse/SOLR-9730
Project: Solr
Issue Type: Improvement
Security Level: Public (Default Security Level. Issues are Public)
Components: Schema and Analysis
Affects Versions: 6.2.1, 5.5.2
Reporter: Ivan Provalov
Priority: Minor
A small optimization suggestion for IndexSchema class, cache the definitions of the dynamic fields:
{code}
private Map<String, SchemaField> cachedDynamicFields = new HashMap<>();
@Override
public SchemaField getFieldOrNull(String fieldName)
{
SchemaField f = fields.get(fieldName);
if (f != null) return f;
f = cachedDynamicFields.get(fieldName);
if (f != null) return f;
for (DynamicField df : dynamicFields) {
if (df.matches(fieldName)) {
f = df.makeSchemaField(fieldName);
cachedDynamicFields.put(fieldName, f);
return f;
}
}
return f;
}
{code}
Are there any reasons not to do this?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org