diff options
author | Geir Storli <geirst@yahoo-inc.com> | 2017-04-05 14:48:33 +0200 |
---|---|---|
committer | Geir Storli <geirst@yahoo-inc.com> | 2017-04-05 14:50:02 +0200 |
commit | a4426306121b434974fb96cc94ee652e93073361 (patch) | |
tree | fbb7bb425c225ed3e12a888343a36d4e02186aef /config-model/src/main/java/com/yahoo/searchdefinition | |
parent | 16d53d7d13ff8011fa33e5cedf4473298541601f (diff) |
Add data and collection type to imported-fields config.
These are the same as the data and collection type of the target attribute field.
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition')
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java | 12 |
1 files changed, 12 insertions, 0 deletions
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()); + } + } |