diff options
8 files changed, 25 insertions, 21 deletions
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 6387cfbdc85..f0b1b427531 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java @@ -302,11 +302,11 @@ public class DocumentModelBuilder { private static StructDataType handleStruct(NewDocumentType dt, SDDocumentType type) { StructDataType s = new StructDataType(type.getName()); - for (Field f : type.getDocumentType().getContentType().getFieldsThisTypeOnly()) { + for (Field f : type.getDocumentType().contentStruct().getFieldsThisTypeOnly()) { specialHandleAnnotationReference(dt, f); s.addField(f); } - for (StructDataType inherited : type.getDocumentType().getContentType().getInheritedTypes()) { + for (StructDataType inherited : type.getDocumentType().contentStruct().getInheritedTypes()) { s.inherit(inherited); } extractNestedTypes(dt, s); @@ -335,7 +335,7 @@ public class DocumentModelBuilder { Map<AnnotationType, String> annotationInheritance = new HashMap<>(); Map<StructDataType, String> structInheritance = new HashMap<>(); NewDocumentType dt = new NewDocumentType(new NewDocumentType.Name(sdoc.getName()), - sdoc.getDocumentType().getContentType(), + sdoc.getDocumentType().contentStruct(), sdoc.getDocumentType().getBodyType(), sdoc.getFieldSets(), convertDocumentReferencesToNames(sdoc.getDocumentReferences())); @@ -387,7 +387,7 @@ public class DocumentModelBuilder { e.getKey().inherit(s); } } - handleStruct(dt, sdoc.getDocumentType().getContentType()); + handleStruct(dt, sdoc.getDocumentType().contentStruct()); handleStruct(dt, sdoc.getDocumentType().getBodyType()); extractDataTypesFromFields(dt, sdoc.fieldSet()); 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 0e9e09844d1..c7b698f5835 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 @@ -151,7 +151,7 @@ public class SDDocumentType implements Cloneable, Serializable { @SuppressWarnings("deprecation") public SDDocumentType(String name, Search search) { docType = new DocumentType(name); - docType.getContentType().setCompressionConfig(new CompressionConfig()); + docType.contentStruct().setCompressionConfig(new CompressionConfig()); docType.getBodyType().setCompressionConfig(new CompressionConfig()); validateId(search); inherit(VESPA_DOCUMENT); @@ -164,8 +164,8 @@ public class SDDocumentType implements Cloneable, Serializable { this.structType = structType; inheritedTypes.clear(); } else { - if (docType.getContentType() != null) { - this.structType = docType.getContentType(); + if (docType.contentStruct() != null) { + this.structType = docType.contentStruct(); inheritedTypes.clear(); } else { throw new IllegalArgumentException("You can not set a null struct"); 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 9e07171c183..02d500931d7 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 @@ -93,7 +93,7 @@ public class DocumentManager { builder.documenttype(doc); doc. name(dt.getName()). - headerstruct(dt.getContentType().getId()). + headerstruct(dt.contentStruct().getId()). bodystruct(dt.getBodyType().getId()); for (DocumentType inherited : dt.getInheritedTypes()) { doc.inherits(new Datatype.Documenttype.Inherits.Builder().name(inherited.getName())); diff --git a/document/src/main/java/com/yahoo/document/Document.java b/document/src/main/java/com/yahoo/document/Document.java index 55183f8fa70..51a1602516e 100644 --- a/document/src/main/java/com/yahoo/document/Document.java +++ b/document/src/main/java/com/yahoo/document/Document.java @@ -120,7 +120,7 @@ public class Document extends StructuredFieldValue { @SuppressWarnings("deprecation") private void setNewType(DocumentType type) { - header = type.getContentType().createFieldValue(); + header = type.contentStruct().createFieldValue(); body = type.getBodyType().createFieldValue(); } diff --git a/document/src/main/java/com/yahoo/document/DocumentType.java b/document/src/main/java/com/yahoo/document/DocumentType.java index f2a501100f2..6244885798e 100755 --- a/document/src/main/java/com/yahoo/document/DocumentType.java +++ b/document/src/main/java/com/yahoo/document/DocumentType.java @@ -100,14 +100,18 @@ public class DocumentType extends StructuredDataType { return false; } - public StructDataType getContentType() { + /** + * Provides the Struct describing the fields in the document. + * @return Struct describing the document fields. + */ + public StructDataType contentStruct() { return headerType; } - // Use getContentType instead + // Use contentStruct instead @Deprecated public StructDataType getHeaderType() { - return getContentType(); + return contentStruct(); } @Deprecated diff --git a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java index 6e842c68641..e45da62353d 100644 --- a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java @@ -112,18 +112,18 @@ public class DocumentSerializationTestCase extends AbstractTypesTest { CompressionConfig noncomp = new CompressionConfig(); CompressionConfig lz4comp = new CompressionConfig(CompressionType.LZ4); { - doc.getDataType().getContentType().setCompressionConfig(noncomp); + doc.getDataType().contentStruct().setCompressionConfig(noncomp); doc.getDataType().getBodyType().setCompressionConfig(noncomp); FileOutputStream fout = new FileOutputStream(path + "document-java-currentversion-uncompressed.dat", false); doc.serialize(fout); fout.close(); } { - doc.getDataType().getContentType().setCompressionConfig(lz4comp); + doc.getDataType().contentStruct().setCompressionConfig(lz4comp); doc.getDataType().getBodyType().setCompressionConfig(lz4comp); FileOutputStream fout = new FileOutputStream(path + "document-java-currentversion-lz4-9.dat", false); doc.serialize(fout); - doc.getDataType().getContentType().setCompressionConfig(noncomp); + doc.getDataType().contentStruct().setCompressionConfig(noncomp); doc.getDataType().getBodyType().setCompressionConfig(noncomp); fout.close(); } diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTestCase.java index 855aea1c9b3..6a2147d6f15 100644 --- a/document/src/test/java/com/yahoo/document/DocumentTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentTestCase.java @@ -806,12 +806,12 @@ public class DocumentTestCase extends DocumentTestCaseBase { CompressionConfig noncomp = new CompressionConfig(); CompressionConfig lz4comp = new CompressionConfig(CompressionType.LZ4); - doc.getDataType().getContentType().setCompressionConfig(lz4comp); + doc.getDataType().contentStruct().setCompressionConfig(lz4comp); doc.getDataType().getBodyType().setCompressionConfig(lz4comp); buf = new GrowableByteBuffer(size, 2.0f); doc.serialize(buf); - doc.getDataType().getContentType().setCompressionConfig(noncomp); + doc.getDataType().contentStruct().setCompressionConfig(noncomp); doc.getDataType().getBodyType().setCompressionConfig(noncomp); fos = new FileOutputStream("src/tests/data/serializejava-compressed.dat"); fos.write(buf.array(), 0, buf.position()); @@ -910,13 +910,13 @@ public class DocumentTestCase extends DocumentTestCaseBase { CompressionConfig noncomp = new CompressionConfig(); CompressionConfig lz4comp = new CompressionConfig(CompressionType.LZ4); - doc.getDataType().getContentType().setCompressionConfig(lz4comp); + doc.getDataType().contentStruct().setCompressionConfig(lz4comp); doc.getDataType().getBodyType().setCompressionConfig(lz4comp); GrowableByteBuffer data = new GrowableByteBuffer(); doc.serialize(data); int size = doc.getSerializedSize(); - doc.getDataType().getContentType().setCompressionConfig(noncomp); + doc.getDataType().contentStruct().setCompressionConfig(noncomp); doc.getDataType().getBodyType().setCompressionConfig(noncomp); assertEquals(size, data.position()); diff --git a/vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java b/vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java index fd627c5839e..a3cb6376b58 100644 --- a/vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java +++ b/vdslib/src/main/java/com/yahoo/vdslib/DynamicDocumentList.java @@ -112,8 +112,8 @@ public class DynamicDocumentList extends DocumentList { metaEntry.timestamp = lastModified; } - if (doc.getDataType().getContentType().getCompressionConfig() != null - && doc.getDataType().getContentType().getCompressionConfig().type != CompressionType.NONE) { + if (doc.getDataType().contentStruct().getCompressionConfig() != null + && doc.getDataType().contentStruct().getCompressionConfig().type != CompressionType.NONE) { metaEntry.flags |= MetaEntry.COMPRESSED; } if (doc.getDataType().getBodyType().getCompressionConfig() != null |