summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-03-21 10:56:39 +0000
committerArne H Juul <arnej@yahooinc.com>2022-03-21 11:24:21 +0000
commit4bb62f3c3885afc4679f0b55cda5fa293d0c9377 (patch)
tree6f37753dcb9242b2ab3afc73adf74118acf28c54 /config-model
parentbff04b8c35e618e4fdcd43743c7865bf5a046344 (diff)
populate matching for key/value of map fields also
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
index 8263352e87f..621e7ce8571 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
@@ -279,9 +279,11 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
java.util.function.BiConsumer<String, DataType> supplyStructField = (fieldName, fieldType) -> {
if (structFields.containsKey(fieldName)) return;
+ Matching subFieldMatching = new Matching();
+ subFieldMatching.merge(this.matching);
String subName = getName().concat(".").concat(fieldName);
var subField = new SDField(sdoc, subName, fieldType, null,
- null, structFieldDepth + 1);
+ subFieldMatching, structFieldDepth + 1);
structFields.put(fieldName, subField);
};
@@ -298,6 +300,12 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
if (dataType instanceof CollectionDataType) {
dataType = ((CollectionDataType)dataType).getNestedType();
}
+ if ((dataType instanceof MapDataType) || (dataType instanceof CollectionDataType)) {
+ // "array of map" or "array of array" will not have any struct fields
+ // TODO: consider what this would mean
+ doneStructFields = true;
+ return;
+ }
SDDocumentType subType = sdoc != null ? sdoc.getType(dataType.getName()) : null;
if (dataType instanceof TemporaryStructuredDataType && subType != null) {
for (Field field : subType.fieldSet()) {
@@ -319,13 +327,11 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
for (Field f : subType.fieldSet()) {
if (f instanceof SDField) {
SDField field = (SDField) f;
- Matching subFieldMatching = new Matching();
- subFieldMatching.merge(this.matching);
- subFieldMatching.merge(field.getMatching());
SDField subField = structFields.get(field.getName());
if (subField != null) {
- // we just made this with no matching, so nop:
- // subFieldMatching.merge(subField.getMatching());
+ // we just made this with a copy of our matching (see above)
+ Matching subFieldMatching = subField.getMatching();
+ subFieldMatching.merge(field.getMatching());
subField.setMatching(subFieldMatching);
}
} else {
@@ -333,6 +339,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
}
}
}
+ // else ("missing subtype for struct fields in: " + this + " type " + getDataType() + " [" + getDataType().getClass().getSimpleName() + "]");
}
doneStructFields = true;
}