From c10677061733478b8e4028fafc68f05972877643 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Thu, 12 Jan 2017 21:48:54 +0100 Subject: Revert "Bratseth/tensor type info in documents" --- .../processing/ValidateFieldTypes.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java') diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java index 9ee5f48a906..1349abc3795 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java @@ -2,7 +2,6 @@ package com.yahoo.searchdefinition.processing; import com.yahoo.config.application.api.DeployLogger; -import com.yahoo.document.TensorDataType; import com.yahoo.searchdefinition.RankProfileRegistry; import com.yahoo.searchdefinition.document.Attribute; import com.yahoo.document.DataType; @@ -50,25 +49,22 @@ public class ValidateFieldTypes extends Processor { DataType seenType = seenFields.get(fieldName); if (seenType == null) { seenFields.put(fieldName, fieldType); - } else if ( ! compatibleTypes(seenType, fieldType)) { - throw newProcessException(searchName, fieldName, "Incompatible types. Expected " + + } else if ( ! equalTypes(seenType, fieldType)) { + throw newProcessException(searchName, fieldName, "Duplicate field name with different types. Expected " + seenType.getName() + " for " + fieldDesc + " '" + fieldName + "', got " + fieldType.getName() + "."); } } - private boolean compatibleTypes(DataType seenType, DataType fieldType) { + private boolean equalTypes(DataType d1, DataType d2) { // legacy tag field type compatibility; probably not needed any more (Oct 2016) - if ("tag".equals(seenType.getName())) { - return "tag".equals(fieldType.getName()) || "WeightedSet".equals(fieldType.getName()); + if ("tag".equals(d1.getName())) { + return "tag".equals(d2.getName()) || "WeightedSet".equals(d2.getName()); } - if ("tag".equals(fieldType.getName())) { - return "tag".equals(seenType.getName()) || "WeightedSet".equals(seenType.getName()); + if ("tag".equals(d2.getName())) { + return "tag".equals(d1.getName()) || "WeightedSet".equals(d1.getName()); } - if (seenType instanceof TensorDataType && fieldType instanceof TensorDataType) { - return fieldType.isAssignableFrom(seenType); // TODO: Just do this for all types - } - return seenType.equals(fieldType); + return d1.equals(d2); } } -- cgit v1.2.3