diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertSchemaCollection.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertSchemaCollection.java index d32fae99f5ab..67e6c88d0437 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertSchemaCollection.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertSchemaCollection.java @@ -33,7 +33,9 @@ import com.yahoo.vespa.documentmodel.SummaryField; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Optional; /** @@ -122,6 +124,8 @@ public void convertTypes() { typeConverter.convert(true); } + private Map convertedDocuments = new LinkedHashMap(); + public List convertToSchemas() { typeConverter = new ConvertParsedTypes(orderedInput, docMan); typeConverter.convert(false); @@ -150,7 +154,9 @@ private void convertDocument(Schema schema, ParsedDocument parsed, { SDDocumentType document = new SDDocumentType(parsed.name()); for (String inherit : parsed.getInherited()) { - document.inherit(new DataTypeName(inherit)); + var parent = convertedDocuments.get(inherit); + assert(parent != null); + document.inherit(parent); } for (var struct : parsed.getStructs()) { var structProxy = fieldConverter.convertStructDeclaration(schema, struct); @@ -165,6 +171,7 @@ private void convertDocument(Schema schema, ParsedDocument parsed, document.setFieldId(sdf, field.idOverride()); } } + convertedDocuments.put(parsed.name(), document); schema.addDocument(document); } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/IntermediateCollection.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/IntermediateCollection.java index 536caf551110..23b5195486b0 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/IntermediateCollection.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/IntermediateCollection.java @@ -12,7 +12,7 @@ import java.io.File; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -27,7 +27,7 @@ public class IntermediateCollection { private final DeployLogger deployLogger; private final ModelContext.Properties modelProperties; - private Map parsedSchemas = new HashMap<>(); + private Map parsedSchemas = new LinkedHashMap<>(); IntermediateCollection() { this.deployLogger = new BaseDeployLogger();