diff options
author | Harald Musum <musum@oath.com> | 2018-10-23 07:56:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-23 07:56:05 +0200 |
commit | bb42d0c6f30de25b9ca6b8e232b6920aeb51a7d1 (patch) | |
tree | 0de964ad5fbd29021a4797f09afb856e3ccdd474 /config-model/src/main/java/com/yahoo/searchdefinition | |
parent | 1cb09174cb579936eae49f7db632113795b0666a (diff) |
Revert "Disallow complex types as keys for nested types in arrays"
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition')
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypes.java | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypes.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypes.java index 1994b1096ce..076161a8584 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypes.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypes.java @@ -2,7 +2,6 @@ package com.yahoo.searchdefinition.processing; import com.yahoo.config.application.api.DeployLogger; -import com.yahoo.document.ArrayDataType; import com.yahoo.searchdefinition.RankProfileRegistry; import com.yahoo.document.DataType; import com.yahoo.document.MapDataType; @@ -27,30 +26,20 @@ public class DisallowComplexMapAndWsetKeyTypes extends Processor { public void process(boolean validate, boolean documentsOnly) { if ( ! validate) return; - // TODO also traverse struct types to search for bad map or wset types. - // Do this after document manager is fixed, do not start using the static stuff on SDDocumentTypes any more. + // TODO also traverse struct types to search for bad map or wset types there. Do this after document manager is fixed, do + // not start using the static stuff on SDDocumentTypes any more. for (SDField field : search.allConcreteFields()) { - checkFieldType(field, field.getDataType()); - } - } - - private void checkFieldType(SDField field, DataType dataType) { - if (dataType instanceof ArrayDataType) { - DataType nestedType = ((ArrayDataType) dataType).getNestedType(); - checkFieldType(field, nestedType); - } else if (dataType instanceof WeightedSetDataType) { - DataType nestedType = ((WeightedSetDataType) dataType).getNestedType(); - if ( ! (nestedType instanceof PrimitiveDataType)) { - fail(search, field, "Weighted set must have a primitive key type."); + if (field.getDataType() instanceof WeightedSetDataType) { + DataType nestedType = ((WeightedSetDataType)field.getDataType()).getNestedType(); + if ( ! (nestedType instanceof PrimitiveDataType)) { + fail(search, field, "Weighted set must have a primitive key type."); + } + } else if (field.getDataType() instanceof MapDataType) { + if ( ! (((MapDataType)field.getDataType()).getKeyType() instanceof PrimitiveDataType)) { + fail(search, field, "Map key type must be a primitive type"); + } } - } else if (dataType instanceof MapDataType) { - DataType keyType = ((MapDataType) dataType).getKeyType(); - if ( ! (keyType instanceof PrimitiveDataType)) { - fail(search, field, "Map key type must be a primitive type."); - } - checkFieldType(field, ((MapDataType) dataType).getValueType()); } - } } |