summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-06-16 07:40:42 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-06-16 09:46:17 +0000
commitfcf38c0586e6166ed819a078355502bda4656d01 (patch)
treeba0fca554bccae26a0bdece24e715cc223c02c6a /config-model/src/main/java
parentc0d8eff2873a2a352b368fe0e616caf812673a33 (diff)
- Removing body struct from our own usage.
- Deprecate public methods using body struct. - Update expected generated config.
Diffstat (limited to 'config-model/src/main/java')
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java30
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java3
5 files changed, 3 insertions, 39 deletions
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
index 41a30c4553d..df9f72b2182 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
@@ -66,7 +66,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
private final Map<Integer, NewDocumentType> inherits = new LinkedHashMap<>();
private final AnnotationTypeRegistry annotations = new AnnotationTypeRegistry();
private final StructDataType header;
- private final StructDataType body;
private final Set<FieldSet> fieldSets = new LinkedHashSet<>();
private final Set<Name> documentReferences;
// Imported fields are virtual and therefore exist outside of the SD's document field definition
@@ -84,7 +83,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
this(
name,
new StructDataType(name.getName() + ".header"),
- new StructDataType(name.getName() + ".body"),
new FieldSets(),
documentReferences,
importedFieldNames);
@@ -96,14 +94,12 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
public NewDocumentType(Name name,
StructDataType header,
- StructDataType body,
FieldSets fs,
Set<Name> documentReferences,
Set<String> importedFieldNames) {
super(name.getName());
this.name = name;
this.header = header;
- this.body = body;
if (fs != null) {
this.fieldSets.addAll(fs.userFieldSets().values());
for (FieldSet f : fs.builtInFieldSets().values()) {
@@ -122,7 +118,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
}
public DataType getHeader() { return header; }
- public DataType getBody() { return body; }
public Collection<NewDocumentType> getInherited() { return inherits.values(); }
public NewDocumentType getInherited(Name inherited) { return inherits.get(inherited.getId()); }
public NewDocumentType removeInherited(Name inherited) { return inherits.remove(inherited.getId()); }
@@ -144,23 +139,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
return ret;
}
- /**
- * Data type of the body fields of this and all inherited document types
- * @return merged {@link StructDataType}
- */
- public StructDataType allBody() {
- StructDataType ret = new StructDataType(body.getName());
- for (Field f : body.getFields()) {
- ret.addField(f);
- }
- for (NewDocumentType inherited : getInherited()) {
- for (Field f : ((StructDataType) inherited.getBody()).getFields()) {
- ret.addField(f);
- }
- }
- return ret;
- }
-
@Override
public Class getValueClass() {
return Document.class;
@@ -219,9 +197,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
public Field getField(String name) {
Field field = header.getField(name);
if (field == null) {
- field = body.getField(name);
- }
- if (field == null) {
for (NewDocumentType inheritedType : inherits.values()) {
field = inheritedType.getField(name);
if (field != null) {
@@ -240,9 +215,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
public Field getField(int id) {
Field field = header.getField(id);
if (field == null) {
- field = body.getField(id);
- }
- if (field == null) {
for (NewDocumentType inheritedType : inherits.values()) {
field = inheritedType.getField(id);
if (field != null) {
@@ -261,14 +233,12 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
}
collection.addAll(header.getFields());
- collection.addAll(body.getFields());
return Collections.unmodifiableCollection(collection);
}
public Collection<Field> getFields() {
Collection<Field> collection = new LinkedList<>();
collection.addAll(header.getFields());
- collection.addAll(body.getFields());
return Collections.unmodifiableCollection(collection);
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
index d3a78321106..fed35382b21 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
@@ -338,7 +338,6 @@ public class DocumentModelBuilder {
Map<StructDataType, String> structInheritance = new HashMap<>();
NewDocumentType dt = new NewDocumentType(new NewDocumentType.Name(sdoc.getName()),
sdoc.getDocumentType().contentStruct(),
- sdoc.getDocumentType().getBodyType(),
sdoc.getFieldSets(),
convertDocumentReferencesToNames(sdoc.getDocumentReferences()),
convertTemporaryImportedFieldsToNames(sdoc.getTemporaryImportedFields()));
@@ -391,7 +390,6 @@ public class DocumentModelBuilder {
}
}
handleStruct(dt, sdoc.getDocumentType().contentStruct());
- handleStruct(dt, sdoc.getDocumentType().getBodyType());
extractDataTypesFromFields(dt, sdoc.fieldSet());
return dt;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
index b3f98cc6f26..c44bf44f4fe 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
@@ -155,7 +155,6 @@ public class SDDocumentType implements Cloneable, Serializable {
public SDDocumentType(String name, Search search) {
docType = new DocumentType(name);
docType.contentStruct().setCompressionConfig(new CompressionConfig());
- docType.getBodyType().setCompressionConfig(new CompressionConfig());
validateId(search);
inherit(VESPA_DOCUMENT);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
index e0d015cc8b2..9b516767c9b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
+++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
@@ -94,8 +94,7 @@ public class DocumentManager {
builder.documenttype(doc);
doc.
name(dt.getName()).
- headerstruct(dt.contentStruct().getId()).
- bodystruct(dt.getBodyType().getId());
+ headerstruct(dt.contentStruct().getId());
for (DocumentType inherited : dt.getInheritedTypes()) {
doc.inherits(new Datatype.Documenttype.Inherits.Builder().name(inherited.getName()));
}
@@ -105,8 +104,7 @@ public class DocumentManager {
builder.documenttype(doc);
doc.
name(dt.getName()).
- headerstruct(dt.getHeader().getId()).
- bodystruct(dt.getBody().getId());
+ headerstruct(dt.getHeader().getId());
for (NewDocumentType inherited : dt.getInherited()) {
doc.inherits(new Datatype.Documenttype.Inherits.Builder().name(inherited.getName()));
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java
index e6bf826dccc..4f075264608 100644
--- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java
+++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java
@@ -42,8 +42,7 @@ public class DocumentTypes {
db.
id(documentType.getId()).
name(documentType.getName()).
- headerstruct(documentType.getHeader().getId()).
- bodystruct(documentType.getBody().getId());
+ headerstruct(documentType.getHeader().getId());
Set<Integer> built = new HashSet<>();
for (NewDocumentType inherited : documentType.getInherited()) {
db.inherits(new DocumenttypesConfig.Documenttype.Inherits.Builder().id(inherited.getId()));