mirror of https://github.com/apache/lucene.git
SOLR-530: Better error messages/warnings when parsing schema.xml: field using bogus fieldtype and multiple copyFields to a non-multiValue field
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@646107 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6042bdbad0
commit
fd4981f444
|
@ -327,6 +327,10 @@ Bug Fixes
|
||||||
specified and there is no defaultSearchField in schema.xml
|
specified and there is no defaultSearchField in schema.xml
|
||||||
(Lars Kotthoff via hossman)
|
(Lars Kotthoff via hossman)
|
||||||
|
|
||||||
|
22. SOLR-530: Better error messages/warnings when parsing schema.xml:
|
||||||
|
field using bogus fieldtype and multiple copyFields to a non-multiValue
|
||||||
|
field. (Shalin Shekhar Mangar via hossman)
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
1. SOLR-135: Moved common classes to org.apache.solr.common and altered the
|
1. SOLR-135: Moved common classes to org.apache.solr.common and altered the
|
||||||
build scripts to make two jars: apache-solr-1.3.jar and
|
build scripts to make two jars: apache-solr-1.3.jar and
|
||||||
|
|
|
@ -425,7 +425,7 @@ public final class IndexSchema {
|
||||||
|
|
||||||
FieldType ft = fieldTypes.get(type);
|
FieldType ft = fieldTypes.get(type);
|
||||||
if (ft==null) {
|
if (ft==null) {
|
||||||
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown fieldtype '" + type + "'",false);
|
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown fieldtype '" + type + "' specified on field " + name,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String,String> args = DOMUtil.toMapExcept(attrs, "name", "type");
|
Map<String,String> args = DOMUtil.toMapExcept(attrs, "name", "type");
|
||||||
|
@ -594,9 +594,18 @@ public final class IndexSchema {
|
||||||
destArr = (SchemaField[])append(destArr,d);
|
destArr = (SchemaField[])append(destArr,d);
|
||||||
}
|
}
|
||||||
copyFields.put(source,destArr);
|
copyFields.put(source,destArr);
|
||||||
copyFieldTarget.add( d );
|
|
||||||
|
copyFieldTargetCounts.put(d, (copyFieldTargetCounts.containsKey(d) ? copyFieldTargetCounts.get(d) + 1 : 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<SchemaField, Integer> entry : copyFieldTargetCounts.entrySet()) {
|
||||||
|
if (entry.getValue() > 1 && !entry.getKey().multiValued()) {
|
||||||
|
log.warning("Field " + entry.getKey().name + " is not multivalued "+
|
||||||
|
"and destination for multiple copyFields ("+
|
||||||
|
entry.getValue()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.finest("Dynamic Copied Fields:" + dCopies);
|
log.finest("Dynamic Copied Fields:" + dCopies);
|
||||||
|
|
||||||
|
@ -976,8 +985,12 @@ public final class IndexSchema {
|
||||||
|
|
||||||
private final Map<String, SchemaField[]> copyFields = new HashMap<String,SchemaField[]>();
|
private final Map<String, SchemaField[]> copyFields = new HashMap<String,SchemaField[]>();
|
||||||
private DynamicCopy[] dynamicCopyFields;
|
private DynamicCopy[] dynamicCopyFields;
|
||||||
private final Set<SchemaField> copyFieldTarget = new HashSet<SchemaField>();
|
/**
|
||||||
|
* keys are all fields copied to, count is num of copyField
|
||||||
|
* directives that target them.
|
||||||
|
*/
|
||||||
|
private Map<SchemaField, Integer> copyFieldTargetCounts
|
||||||
|
= new HashMap<SchemaField, Integer>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all copy fields, both the static and the dynamic ones.
|
* Get all copy fields, both the static and the dynamic ones.
|
||||||
|
@ -1040,7 +1053,7 @@ public final class IndexSchema {
|
||||||
*/
|
*/
|
||||||
public boolean isCopyFieldTarget( SchemaField f )
|
public boolean isCopyFieldTarget( SchemaField f )
|
||||||
{
|
{
|
||||||
return copyFieldTarget.contains( f );
|
return copyFieldTargetCounts.containsKey( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue