summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahoo-inc.com>2017-08-16 14:14:54 +0200
committerGeir Storli <geirst@yahoo-inc.com>2017-08-16 14:14:54 +0200
commit02daa1ecf2670937a7437e706e073c39ccd5128b (patch)
tree68a6835f4b081f451cd373279aa902f58973a430 /config-model
parent50943c28f6dc44520afca08e6a5ce06b48451249 (diff)
Fix bug in deriving of attributes config for imported fields.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java10
-rw-r--r--config-model/src/test/derived/importedfields/attributes.cfg8
2 files changed, 9 insertions, 9 deletions
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<String, Attribute> 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