From 02daa1ecf2670937a7437e706e073c39ccd5128b Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Wed, 16 Aug 2017 14:14:54 +0200 Subject: Fix bug in deriving of attributes config for imported fields. --- .../com/yahoo/searchdefinition/derived/AttributeFields.java | 10 +++++----- config-model/src/test/derived/importedfields/attributes.cfg | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'config-model') diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java index 1775c69f669..ce3ff7cc447 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java @@ -144,9 +144,9 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce return (fs == FieldSet.ALL) || ((fs == FieldSet.FAST_ACCESS) && attribute.isFastAccess()); } - private AttributesConfig.Attribute.Builder getConfig(Attribute attribute, boolean imported) { + private AttributesConfig.Attribute.Builder getConfig(String attrName, Attribute attribute, boolean imported) { AttributesConfig.Attribute.Builder aaB = new AttributesConfig.Attribute.Builder() - .name(attribute.getName()) + .name(attrName) .datatype(AttributesConfig.Attribute.Datatype.Enum.valueOf(attribute.getType().getExportAttributeTypeName())) .collectiontype(AttributesConfig.Attribute.Collectiontype.Enum.valueOf(attribute.getCollectionType().getName())); if (attribute.isRemoveIfZero()) { @@ -192,12 +192,12 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce public void getConfig(AttributesConfig.Builder builder, FieldSet fs) { for (Attribute attribute : attributes.values()) { if (isAttributeInFieldSet(attribute, fs)) { - builder.attribute(getConfig(attribute, false)); + builder.attribute(getConfig(attribute.getName(), attribute, false)); } } if (fs == FieldSet.ALL) { - for (Attribute attribute : importedAttributes.values()) { - builder.attribute(getConfig(attribute, true)); + for (Map.Entry entry : importedAttributes.entrySet()) { + builder.attribute(getConfig(entry.getKey(), entry.getValue(), true)); } } } diff --git a/config-model/src/test/derived/importedfields/attributes.cfg b/config-model/src/test/derived/importedfields/attributes.cfg index df0dd4f8ac4..74348377ceb 100644 --- a/config-model/src/test/derived/importedfields/attributes.cfg +++ b/config-model/src/test/derived/importedfields/attributes.cfg @@ -38,7 +38,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false -attribute[].name "int_field" +attribute[].name "my_int_field" attribute[].datatype INT32 attribute[].collectiontype SINGLE attribute[].removeifzero false @@ -58,7 +58,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true -attribute[].name "string_field" +attribute[].name "my_string_field" attribute[].datatype STRING attribute[].collectiontype SINGLE attribute[].removeifzero false @@ -78,7 +78,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true -attribute[].name "int_array_field" +attribute[].name "my_int_array_field" attribute[].datatype INT32 attribute[].collectiontype ARRAY attribute[].removeifzero false @@ -98,7 +98,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true -attribute[].name "int_wset_field" +attribute[].name "my_int_wset_field" attribute[].datatype INT32 attribute[].collectiontype WEIGHTEDSET attribute[].removeifzero false -- cgit v1.2.3