mirror of https://github.com/apache/lucene.git
move docValuesType checking down to FieldInfo
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1439722 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
905cf63c0e
commit
726659bf9a
|
@ -55,12 +55,7 @@ final class DocValuesProcessor extends StoredFieldsConsumer {
|
|||
// nocommit: these checks are duplicated everywhere
|
||||
final DocValuesType dvType = field.fieldType().docValueType();
|
||||
if (dvType != null) {
|
||||
DocValuesType currentDVType = fieldInfo.getDocValuesType();
|
||||
if (currentDVType == null) {
|
||||
fieldInfo.setDocValuesType(dvType);
|
||||
} else if (currentDVType != dvType) {
|
||||
throw new IllegalArgumentException("cannot change DocValues type from " + currentDVType + " to " + dvType + " for field \"" + fieldInfo.name + "\"");
|
||||
}
|
||||
fieldInfo.setDocValuesType(dvType);
|
||||
if (dvType == DocValuesType.BINARY) {
|
||||
addBinaryField(fieldInfo, docID, field.binaryValue());
|
||||
} else if (dvType == DocValuesType.SORTED) {
|
||||
|
|
|
@ -185,6 +185,9 @@ public final class FieldInfo {
|
|||
}
|
||||
|
||||
void setDocValuesType(DocValuesType type) {
|
||||
if (docValueType != null && docValueType != type) {
|
||||
throw new IllegalArgumentException("cannot change DocValues type from " + docValueType + " to " + type + " for field \"" + name + "\"");
|
||||
}
|
||||
docValueType = type;
|
||||
assert checkConsistency();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue