From a4426306121b434974fb96cc94ee652e93073361 Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Wed, 5 Apr 2017 14:48:33 +0200 Subject: Add data and collection type to imported-fields config. These are the same as the data and collection type of the target attribute field. --- .../com/yahoo/searchdefinition/derived/ImportedFields.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'config-model/src/main/java/com/yahoo/searchdefinition') diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java index 135eeebde6c..788cad27c7c 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java @@ -2,6 +2,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.document.Attribute; import com.yahoo.searchdefinition.document.ImportedField; import com.yahoo.vespa.config.search.ImportedFieldsConfig; @@ -45,10 +46,21 @@ public class ImportedFields extends Derived implements ImportedFieldsConfig.Prod private static ImportedFieldsConfig.Attribute.Builder createAttributeBuilder(ImportedField field) { ImportedFieldsConfig.Attribute.Builder result = new ImportedFieldsConfig.Attribute.Builder(); + Attribute targetAttribute = field.targetField().getAttributes().get(field.targetField().getName()); result.name(field.fieldName()); result.referencefield(field.reference().referenceField().getName()); result.targetfield(field.targetField().getName()); + result.datatype(getDataType(targetAttribute)); + result.collectiontype(getCollectionType(targetAttribute)); return result; } + private static ImportedFieldsConfig.Attribute.Datatype.Enum getDataType(Attribute targetAttribute) { + return ImportedFieldsConfig.Attribute.Datatype.Enum.valueOf(targetAttribute.getType().getExportAttributeTypeName()); + } + + private static ImportedFieldsConfig.Attribute.Collectiontype.Enum getCollectionType(Attribute targetAttribute) { + return ImportedFieldsConfig.Attribute.Collectiontype.Enum.valueOf(targetAttribute.getCollectionType().getName()); + } + } -- cgit v1.2.3