aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java5
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java60
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java6
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java2
-rw-r--r--config-model/src/main/javacc/SDParser.jj4
-rw-r--r--docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java4
-rw-r--r--document/abi-spec.json2
-rwxr-xr-xdocument/src/main/java/com/yahoo/document/DocumentType.java15
-rw-r--r--document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java4
-rw-r--r--document/src/main/java/com/yahoo/document/Field.java26
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java2
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java2
-rwxr-xr-xdocument/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java10
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentIdTestCase.java6
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java28
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTestCase.java64
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java12
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java14
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java4
-rw-r--r--document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java4
-rw-r--r--document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java24
-rw-r--r--document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java22
-rw-r--r--document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java12
25 files changed, 162 insertions, 174 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java b/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
index 9ff749a994c..ade8ae21870 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
@@ -41,7 +41,7 @@ public class FieldOperationApplierForStructs extends FieldOperationApplier {
}
if (structUsedByField.getName().equals(structType.getName())) {
//this field is using this type!!
- field.populateWithStructFields(sdoc, field.getName(), field.getDataType(), field.isHeader(), 0);
+ field.populateWithStructFields(sdoc, field.getName(), field.getDataType(), 0);
field.populateWithStructMatching(sdoc, field.getName(), field.getDataType(), field.getMatching());
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
index 60b8ee78c7b..d8773063053 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
@@ -138,11 +138,10 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
return Collections.singletonList(field);
}
if (fieldType instanceof ArrayDataType) {
- boolean header = field.isHeader();
List<Field> ret = new LinkedList<>();
- Field innerField = new Field(field.getName(), ((ArrayDataType)fieldType).getNestedType(), header);
+ Field innerField = new Field(field.getName(), ((ArrayDataType)fieldType).getNestedType());
for (Field flatField : flattenField(innerField)) {
- ret.add(new Field(flatField.getName(), DataType.getArray(flatField.getDataType()), header));
+ ret.add(new Field(flatField.getName(), DataType.getArray(flatField.getDataType())));
}
return ret;
}
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 c657d29033a..4fe6c3a96f2 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
@@ -38,9 +38,8 @@ import java.util.TreeMap;
/**
* The field class represents a document field. It is used in
- * the Document class to get and set fields. Each SDField has
- * a name, a numeric ID, a data type, and a boolean that says whether it's
- * a header field. The numeric ID is used when the fields are stored
+ * the Document class to get and set fields. Each SDField has a name, a numeric ID,
+ * a data type. The numeric ID is used when the fields are stored
* in serialized form.
*
* @author bratseth
@@ -120,15 +119,14 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
* Creates a new field. This method is only used to create reserved fields
* @param name The name of the field
* @param dataType The datatype of the field
- * @param isHeader Whether this is a "header" field or a "content" field (true = "header").
*/
- protected SDField(SDDocumentType repo, String name, int id, DataType dataType, boolean isHeader, boolean populate) {
- super(name, id, dataType, isHeader);
- populate(populate, repo, name, dataType, isHeader);
+ protected SDField(SDDocumentType repo, String name, int id, DataType dataType, boolean populate) {
+ super(name, id, dataType);
+ populate(populate, repo, name, dataType);
}
- public SDField(SDDocumentType repo, String name, int id, DataType dataType, boolean isHeader) {
- this(repo, name, id, dataType, isHeader, true);
+ public SDField(SDDocumentType repo, String name, int id, DataType dataType) {
+ this(repo, name, id, dataType, true);
}
/**
@@ -136,41 +134,35 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
@param name The name of the field
@param dataType The datatype of the field
- @param isHeader Whether this is a "header" field or a "content" field
- (true = "header").
*/
- public SDField(SDDocumentType repo, String name, DataType dataType, boolean isHeader, boolean populate) {
- super(name,dataType,isHeader);
- populate(populate, repo, name, dataType, isHeader);
+ public SDField(SDDocumentType repo, String name, DataType dataType, boolean populate) {
+ super(name,dataType);
+ populate(populate, repo, name, dataType);
}
- private void populate(boolean populate, SDDocumentType repo, String name, DataType dataType, boolean isHeader) {
- populate(populate,repo, name, dataType, isHeader, null, 0);
+ private void populate(boolean populate, SDDocumentType repo, String name, DataType dataType) {
+ populate(populate,repo, name, dataType, null, 0);
}
- private void populate(boolean populate, SDDocumentType repo, String name, DataType dataType, boolean isHeader, Matching fieldMatching, int recursion) {
+ private void populate(boolean populate, SDDocumentType repo, String name, DataType dataType, Matching fieldMatching, int recursion) {
if (populate || (dataType instanceof MapDataType)) {
- populateWithStructFields(repo, name, dataType, isHeader, recursion);
+ populateWithStructFields(repo, name, dataType, recursion);
populateWithStructMatching(repo, name, dataType, fieldMatching);
}
}
- public SDField(String name, DataType dataType, boolean isHeader) {
- this(null, name, dataType, isHeader, true);
- }
/**
* Creates a new field.
*
* @param name The name of the field
* @param dataType The datatype of the field
- * @param isHeader Whether this is a "header" field or a "content" field (true = "header").
* @param owner the owning document (used to check for id collisions)
*/
- protected SDField(SDDocumentType repo, String name, DataType dataType, boolean isHeader, SDDocumentType owner, boolean populate) {
- super(name, dataType, isHeader, owner == null ? null : owner.getDocumentType());
+ protected SDField(SDDocumentType repo, String name, DataType dataType, SDDocumentType owner, boolean populate) {
+ super(name, dataType, owner == null ? null : owner.getDocumentType());
this.ownerDocType=owner;
- populate(populate, repo, name, dataType, isHeader);
+ populate(populate, repo, name, dataType);
}
/**
@@ -178,27 +170,25 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
*
* @param name The name of the field
* @param dataType The datatype of the field
- * @param isHeader Whether this is a "header" field or a "content" field (true = "header").
* @param owner The owning document (used to check for id collisions)
* @param fieldMatching The matching object to set for the field
*/
- protected SDField(SDDocumentType repo, String name, DataType dataType, boolean isHeader, SDDocumentType owner,
+ protected SDField(SDDocumentType repo, String name, DataType dataType, SDDocumentType owner,
Matching fieldMatching, boolean populate, int recursion) {
- super(name, dataType, isHeader, owner == null ? null : owner.getDocumentType());
+ super(name, dataType, owner == null ? null : owner.getDocumentType());
this.ownerDocType=owner;
if (fieldMatching != null)
this.setMatching(fieldMatching);
- populate(populate, repo, name, dataType, isHeader, fieldMatching, recursion);
+ populate(populate, repo, name, dataType, fieldMatching, recursion);
}
/**
- * Constructor for <b>header</b> fields
*
* @param name The name of the field
* @param dataType The datatype of the field
*/
public SDField(SDDocumentType repo, String name, DataType dataType) {
- this(repo, name,dataType,true, true);
+ this(repo, name,dataType, true);
}
public SDField(String name, DataType dataType) {
this(null, name,dataType);
@@ -277,7 +267,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
}
}
- public void populateWithStructFields(SDDocumentType sdoc, String name, DataType dataType, boolean isHeader, int recursion) {
+ public void populateWithStructFields(SDDocumentType sdoc, String name, DataType dataType, int recursion) {
DataType dt = getFirstStructOrMapRecursive();
if (dt == null) {
return;
@@ -286,11 +276,11 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
MapDataType mdt = (MapDataType) dataType;
SDField keyField = new SDField(sdoc, name.concat(".key"), mdt.getKeyType(),
- isHeader, getOwnerDocType(), new Matching(), true, recursion + 1);
+ getOwnerDocType(), new Matching(), true, recursion + 1);
structFields.put("key", keyField);
SDField valueField = new SDField(sdoc, name.concat(".value"), mdt.getValueType(),
- isHeader, getOwnerDocType(), new Matching(), true, recursion + 1);
+ getOwnerDocType(), new Matching(), true, recursion + 1);
structFields.put("value", valueField);
} else {
if (recursion >= 10) {
@@ -306,7 +296,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
}
for (Field field : subType.fieldSet()) {
SDField subField = new SDField(sdoc, name.concat(".").concat(field.getName()), field.getDataType(),
- isHeader, subType, new Matching(), true, recursion + 1);
+ subType, new Matching(), true, recursion + 1);
structFields.put(field.getName(), subField);
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java
index 886bf777d3a..04d11792379 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java
@@ -8,12 +8,12 @@ import com.yahoo.document.DataType;
*/
public class TemporarySDField extends SDField {
- public TemporarySDField(String name, DataType dataType, boolean isHeader, SDDocumentType owner) {
- super(owner, name, dataType, isHeader, owner, false);
+ public TemporarySDField(String name, DataType dataType, SDDocumentType owner) {
+ super(owner, name, dataType, owner, false);
}
public TemporarySDField(String name, DataType dataType) {
- super(null, name, dataType, true, false);
+ super(null, name, dataType, false);
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
index d1eb18c4916..0ffd13927b4 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
@@ -71,7 +71,7 @@ public class AddExtraFieldsToDocument extends Processor {
if (docField == null) {
ImmutableSDField existingField = search.getField(field.getName());
if (existingField == null) {
- SDField newField = new SDField(document, field.getName(), field.getDataType(), field.isHeader(), true);
+ SDField newField = new SDField(document, field.getName(), field.getDataType(), true);
newField.setIsExtraField(true);
document.addField(newField);
} else if (!existingField.isImportedField()) {
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java
index d0a0bbfb748..d6398bc348c 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java
@@ -61,7 +61,7 @@ public class UriHack extends Processor {
String partName = uriName + "." + suffix;
// I wonder if this is explicit in qrs or implicit in backend?
// search.addFieldSetItem(uriName, partName);
- SDField partField = new SDField(partName, generatedType, true);
+ SDField partField = new SDField(partName, generatedType);
partField.setIndexStructureField(uriField.doesIndexing());
partField.setRankType(uriField.getRankType());
partField.setStemming(Stemming.NONE);
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index 3c09a521715..eb7d7763cd1 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -637,7 +637,7 @@ void field(SDDocumentType document, Search search) :
if (name != null && com.yahoo.searchdefinition.Search.isReservedName(name.toLowerCase())) {
throw new IllegalArgumentException("Reserved name '" + name + "' can not be used as a field name.");
}
- field = new TemporarySDField(name, type, true, document);
+ field = new TemporarySDField(name, type, document);
}
lbrace() (fieldBody(field, search, document) (<NL>)*)* <RBRACE>
{
@@ -931,7 +931,7 @@ void structFieldDefinition(SDDocumentType struct) :
if (name != null && com.yahoo.searchdefinition.Search.isReservedName(name.toLowerCase())) {
throw new IllegalArgumentException("Reserved name '" + name + "' can not be used as a field name.");
}
- field = new TemporarySDField(name, type, true, struct);
+ field = new TemporarySDField(name, type, struct);
struct.addField(field);
}
lbrace() (id(field,struct) (<NL>)*)? (match(field) (<NL>)*)* <RBRACE> {
diff --git a/docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java b/docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java
index 6868bc8ecd4..4160f366fdb 100644
--- a/docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java
+++ b/docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java
@@ -37,8 +37,8 @@ public class ProcessingUpdateTestCase {
@Test
public void testProcessingUpdates() {
DocumentType articleType = new DocumentType("article");
- Field bodyField = new Field("body", DataType.STRING, true);
- Field titleField = new Field("title", DataType.STRING, true);
+ Field bodyField = new Field("body", DataType.STRING);
+ Field titleField = new Field("title", DataType.STRING);
articleType.addField(bodyField);
articleType.addField(titleField);
dtm = new DocumentTypeManager();
diff --git a/document/abi-spec.json b/document/abi-spec.json
index e4917a174a6..9b67eeb97ee 100644
--- a/document/abi-spec.json
+++ b/document/abi-spec.json
@@ -1457,8 +1457,10 @@
],
"methods": [
"public void <init>(java.lang.String, int, com.yahoo.document.DataType, boolean)",
+ "public void <init>(java.lang.String, int, com.yahoo.document.DataType)",
"public void <init>(java.lang.String)",
"public void <init>(java.lang.String, com.yahoo.document.DataType, boolean, com.yahoo.document.DocumentType)",
+ "public void <init>(java.lang.String, com.yahoo.document.DataType, com.yahoo.document.DocumentType)",
"public void <init>(java.lang.String, com.yahoo.document.DataType, boolean)",
"public void <init>(java.lang.String, com.yahoo.document.DataType)",
"public void <init>(java.lang.String, com.yahoo.document.Field)",
diff --git a/document/src/main/java/com/yahoo/document/DocumentType.java b/document/src/main/java/com/yahoo/document/DocumentType.java
index f3ff6e4ed30..42ccca9f477 100755
--- a/document/src/main/java/com/yahoo/document/DocumentType.java
+++ b/document/src/main/java/com/yahoo/document/DocumentType.java
@@ -181,8 +181,7 @@ public class DocumentType extends StructuredDataType {
if (isRegistered()) {
throw new IllegalStateException("You cannot add fields to a document type that is already registered.");
}
- StructDataType struct = (field.isHeader() ? headerType : bodyType);
- struct.addField(field);
+ headerType.addField(field);
}
// Do not use, public only for testing
@@ -221,8 +220,8 @@ public class DocumentType extends StructuredDataType {
if (isRegistered()) {
throw new IllegalStateException("You cannot add fields to a document type that is already registered.");
}
- Field field = new Field(name, type, false);
- bodyType.addField(field);
+ Field field = new Field(name, type);
+ headerType.addField(field);
return field;
}
@@ -234,13 +233,9 @@ public class DocumentType extends StructuredDataType {
* @return The field created
* TODO Fix searchdefinition so that exception can be thrown if filed is already registerd
*/
+ @Deprecated
public Field addHeaderField(String name, DataType type) {
- if (isRegistered()) {
- throw new IllegalStateException("You cannot add fields to a document type that is already registered.");
- }
- Field field = new Field(name, type, true);
- headerType.addField(field);
- return field;
+ return addField(name, type);
}
/**
diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
index 154c25880a9..5e698e980ff 100644
--- a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
+++ b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
@@ -180,9 +180,9 @@ public class DocumentTypeManagerConfigurer implements ConfigSubscriber.SingleSub
: manager.getDataType(field.datatype(), field.detailedtype());
if (field.id().size() == 1) {
- type.addField(new Field(field.name(), field.id().get(0).id(), fieldType, true));
+ type.addField(new Field(field.name(), field.id().get(0).id(), fieldType));
} else {
- type.addField(new Field(field.name(), fieldType, true));
+ type.addField(new Field(field.name(), fieldType));
}
}
manager.register(type);
diff --git a/document/src/main/java/com/yahoo/document/Field.java b/document/src/main/java/com/yahoo/document/Field.java
index 671c8c7f763..9be4036174c 100644
--- a/document/src/main/java/com/yahoo/document/Field.java
+++ b/document/src/main/java/com/yahoo/document/Field.java
@@ -21,7 +21,6 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab
protected DataType dataType;
protected int fieldId;
- private boolean isHeader;
private boolean forcedId;
/**
@@ -32,11 +31,14 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab
* @param isHeader Whether this is a "header" field or a "content" field
* (true = "header").
*/
+ @Deprecated
public Field(String name, int id, DataType dataType, boolean isHeader) {
+ this(name, id, dataType);
+ }
+ public Field(String name, int id, DataType dataType) {
super(name);
this.fieldId = id;
this.dataType = dataType;
- this.isHeader = isHeader;
this.forcedId = true;
validateId(id, null);
}
@@ -55,8 +57,13 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab
* (true = "header").
* @param owner the owning document (used to check for id collisions)
*/
+ @Deprecated
public Field(String name, DataType dataType, boolean isHeader, DocumentType owner) {
- this(name, 0, dataType, isHeader);
+ this(name, dataType, owner);
+ }
+
+ public Field(String name, DataType dataType, DocumentType owner) {
+ this(name, 0, dataType);
this.fieldId = calculateIdV7(owner);
this.forcedId = false;
}
@@ -69,8 +76,9 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab
* @param isHeader Whether this is a "header" field or a "content" field
* (true = "header").
*/
+ @Deprecated
public Field(String name, DataType dataType, boolean isHeader) {
- this(name, dataType, isHeader, null);
+ this(name, dataType);
}
/**
@@ -80,7 +88,7 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab
* @param dataType The datatype of the field
*/
public Field(String name, DataType dataType) {
- this(name, dataType, true);
+ this(name, dataType, null);
}
/**
@@ -89,7 +97,7 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab
*/
// TODO: Decide on one copy/clone idiom and do it for this and all it is calling
public Field(String name, Field field) {
- this(name, field.dataType, field.isHeader, null);
+ this(name, field.dataType, null);
}
public int compareTo(Object o) {
@@ -196,14 +204,12 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab
/** @deprecated this has no longer any semantic meaning as this is no longer an aspect with a field */
@Deprecated // TODO: Remove on Vespa 8
public boolean isHeader() {
- return isHeader;
+ return true;
}
/** @deprecated this has no longer any semantic meaning as this is no longer an aspect with a field */
@Deprecated // TODO: Remove on Vespa 8
- public void setHeader(boolean header) {
- this.isHeader = header;
- }
+ public void setHeader(boolean header) { }
/** Two fields are equal if they have the same name and the same data type */
@Override
diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java
index c2111edfd10..630f204c44d 100644
--- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java
+++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java
@@ -82,7 +82,7 @@ public class VespaDocumentSerializer6 extends BufferSerializer implements Docume
}
public void write(Document doc) {
- write(new Field(doc.getDataType().getName(), 0, doc.getDataType(), true), doc);
+ write(new Field(doc.getDataType().getName(), 0, doc.getDataType()), doc);
}
@SuppressWarnings("deprecation")
diff --git a/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java b/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java
index 0d6b0cae926..5db98f26141 100644
--- a/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java
+++ b/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java
@@ -320,7 +320,7 @@ public final class XmlDocumentWriter implements DocumentWriter {
buffer = new XmlStream();
buffer.setIndent(indent);
optionalWrapperMarker.clear();
- write(new Field(document.getDataType().getName(), 0, document.getDataType(), true), document);
+ write(new Field(document.getDataType().getName(), 0, document.getDataType()), document);
}
@Override
diff --git a/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java b/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java
index fb2d478d38b..36cc18ebd6b 100755
--- a/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java
@@ -27,11 +27,11 @@ public class DocumentCalculatorTestCase {
docMan = new DocumentTypeManager();
testDocType = new DocumentType("testdoc");
- testDocType.addHeaderField("byteattr", DataType.BYTE);
- testDocType.addHeaderField("intattr", DataType.INT);
- testDocType.addHeaderField("longattr", DataType.LONG);
- testDocType.addHeaderField("doubleattr", DataType.DOUBLE);
- testDocType.addHeaderField("missingattr", DataType.INT);
+ testDocType.addField("byteattr", DataType.BYTE);
+ testDocType.addField("intattr", DataType.INT);
+ testDocType.addField("longattr", DataType.LONG);
+ testDocType.addField("doubleattr", DataType.DOUBLE);
+ testDocType.addField("missingattr", DataType.INT);
docMan.registerDocumentType(testDocType);
doc = new Document(testDocType, new DocumentId("id:ns:testdoc::testdoc:http://www.ntnu.no/"));
diff --git a/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java b/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java
index 08abd6e6a2d..fea3b265b6d 100644
--- a/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java
@@ -34,11 +34,11 @@ public class DocumentIdTestCase {
public void setUp() {
DocumentType testDocType = new DocumentType("testdoc");
- testDocType.addHeaderField("intattr", DataType.INT);
+ testDocType.addField("intattr", DataType.INT);
testDocType.addField("rawattr", DataType.RAW);
testDocType.addField("floatattr", DataType.FLOAT);
- testDocType.addHeaderField("stringattr", DataType.STRING);
- testDocType.addHeaderField("Minattr", DataType.INT);
+ testDocType.addField("stringattr", DataType.STRING);
+ testDocType.addField("Minattr", DataType.INT);
manager.registerDocumentType(testDocType);
}
diff --git a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
index bc1224ca8ea..fa47c80c6fb 100644
--- a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
@@ -62,25 +62,25 @@ public class DocumentSerializationTestCase extends AbstractTypesTest {
public void testSerializationAllVersions() throws IOException {
DocumentType docInDocType = new DocumentType("docindoc");
- docInDocType.addField(new Field("stringindocfield", DataType.STRING, false));
+ docInDocType.addField(new Field("stringindocfield", DataType.STRING));
DocumentType docType = new DocumentType("serializetest");
- docType.addField(new Field("floatfield", DataType.FLOAT, true));
- docType.addField(new Field("stringfield", DataType.STRING, true));
- docType.addField(new Field("longfield", DataType.LONG, true));
- docType.addField(new Field("urifield", DataType.URI, true));
- docType.addField(new Field("intfield", DataType.INT, false));
- docType.addField(new Field("rawfield", DataType.RAW, false));
- docType.addField(new Field("doublefield", DataType.DOUBLE, false));
- docType.addField(new Field("bytefield", DataType.BYTE, false));
- docType.addField(new Field("boolfield", DataType.BOOL, false));
+ docType.addField(new Field("floatfield", DataType.FLOAT));
+ docType.addField(new Field("stringfield", DataType.STRING));
+ docType.addField(new Field("longfield", DataType.LONG));
+ docType.addField(new Field("urifield", DataType.URI));
+ docType.addField(new Field("intfield", DataType.INT));
+ docType.addField(new Field("rawfield", DataType.RAW));
+ docType.addField(new Field("doublefield", DataType.DOUBLE));
+ docType.addField(new Field("bytefield", DataType.BYTE));
+ docType.addField(new Field("boolfield", DataType.BOOL));
DataType arrayOfFloatDataType = new ArrayDataType(DataType.FLOAT);
- docType.addField(new Field("arrayoffloatfield", arrayOfFloatDataType, false));
+ docType.addField(new Field("arrayoffloatfield", arrayOfFloatDataType));
DataType arrayOfArrayOfFloatDataType = new ArrayDataType(arrayOfFloatDataType);
- docType.addField(new Field("arrayofarrayoffloatfield", arrayOfArrayOfFloatDataType, false));
- docType.addField(new Field("docfield", DataType.DOCUMENT, false));
+ docType.addField(new Field("arrayofarrayoffloatfield", arrayOfArrayOfFloatDataType));
+ docType.addField(new Field("docfield", DataType.DOCUMENT));
DataType weightedSetDataType = DataType.getWeightedSet(DataType.STRING, false, false);
- docType.addField(new Field("wsfield", weightedSetDataType, false));
+ docType.addField(new Field("wsfield", weightedSetDataType));
DocumentTypeManager docMan = new DocumentTypeManager();
docMan.register(docInDocType);
diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTestCase.java
index 141a74a24fe..dcd4622b3f4 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTestCase.java
@@ -107,26 +107,26 @@ public class DocumentTestCase extends DocumentTestCaseBase {
docMan = new DocumentTypeManager();
DocumentType docInDocType = new DocumentType("docindoc");
- docInDocType.addField(new Field("tull", 2, docMan.getDataType(2), true));
+ docInDocType.addField(new Field("tull", 2, docMan.getDataType(2)));
docMan.registerDocumentType(docInDocType);
DocumentType sertestDocType = new DocumentType("sertest");
- sertestDocType.addField(new Field("mailid", 2, docMan.getDataType(2), true));
- sertestDocType.addField(new Field("date", 3, docMan.getDataType(0), true));
- sertestDocType.addField(new Field("from", 4, docMan.getDataType(2), true));
- sertestDocType.addField(new Field("to", 6, docMan.getDataType(2), true));
- sertestDocType.addField(new Field("subject", 9, docMan.getDataType(2), true));
- sertestDocType.addField(new Field("body", 10, docMan.getDataType(2), false));
- sertestDocType.addField(new Field("attachmentcount", 11, docMan.getDataType(0), false));
- sertestDocType.addField(new Field("attachments", 1081629685, DataType.getArray(docMan.getDataType(2)), false));
- sertestDocType.addField(new Field("rawfield", 879, DataType.RAW, false));
- sertestDocType.addField(new Field("weightedfield", 880, DataType.getWeightedSet(DataType.STRING), false));
- sertestDocType.addField(new Field("weightedfieldCreate", 881, DataType.getWeightedSet(DataType.STRING, true, false), false));
- sertestDocType.addField(new Field("docindoc", 882, docInDocType, false));
- sertestDocType.addField(new Field("mapfield", 883, new MapDataType(DataType.STRING, DataType.STRING), false));
- sertestDocType.addField(new Field("myposfield", 884, PositionDataType.INSTANCE, false));
- sertestDocType.addField(new Field("myboolfield", 885, DataType.BOOL, false));
+ sertestDocType.addField(new Field("mailid", 2, docMan.getDataType(2)));
+ sertestDocType.addField(new Field("date", 3, docMan.getDataType(0)));
+ sertestDocType.addField(new Field("from", 4, docMan.getDataType(2)));
+ sertestDocType.addField(new Field("to", 6, docMan.getDataType(2)));
+ sertestDocType.addField(new Field("subject", 9, docMan.getDataType(2)));
+ sertestDocType.addField(new Field("body", 10, docMan.getDataType(2)));
+ sertestDocType.addField(new Field("attachmentcount", 11, docMan.getDataType(0)));
+ sertestDocType.addField(new Field("attachments", 1081629685, DataType.getArray(docMan.getDataType(2))));
+ sertestDocType.addField(new Field("rawfield", 879, DataType.RAW));
+ sertestDocType.addField(new Field("weightedfield", 880, DataType.getWeightedSet(DataType.STRING)));
+ sertestDocType.addField(new Field("weightedfieldCreate", 881, DataType.getWeightedSet(DataType.STRING, true, false)));
+ sertestDocType.addField(new Field("docindoc", 882, docInDocType));
+ sertestDocType.addField(new Field("mapfield", 883, new MapDataType(DataType.STRING, DataType.STRING)));
+ sertestDocType.addField(new Field("myposfield", 884, PositionDataType.INSTANCE));
+ sertestDocType.addField(new Field("myboolfield", 885, DataType.BOOL));
docMan.registerDocumentType(sertestDocType);
}
@@ -880,13 +880,13 @@ public class DocumentTestCase extends DocumentTestCaseBase {
public void testInheritance() {
// Create types that inherit each other.. And test that it works..
DocumentType parentType = new DocumentType("parent");
- parentType.addField(new Field("parentbodyint", DataType.INT, false));
- parentType.addField(new Field("parentheaderint", DataType.INT, true));
- parentType.addField(new Field("overwritten", DataType.INT, true));
+ parentType.addField(new Field("parentbodyint", DataType.INT));
+ parentType.addField(new Field("parentheaderint", DataType.INT));
+ parentType.addField(new Field("overwritten", DataType.INT));
DocumentType childType = new DocumentType("child");
- childType.addField(new Field("childbodyint", DataType.INT, false));
- childType.addField(new Field("childheaderint", DataType.INT, true));
- childType.addField(new Field("overwritten", DataType.INT, true));
+ childType.addField(new Field("childbodyint", DataType.INT));
+ childType.addField(new Field("childheaderint", DataType.INT));
+ childType.addField(new Field("overwritten", DataType.INT));
childType.inherit(parentType);
DocumentTypeManager manager = new DocumentTypeManager();
@@ -914,13 +914,13 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testInheritanceTypeMismatch() {
DocumentType parentType = new DocumentType("parent");
- parentType.addField(new Field("parentbodyint", DataType.INT, false));
- parentType.addField(new Field("parentheaderint", DataType.INT, true));
- parentType.addField(new Field("overwritten", DataType.STRING, true));
+ parentType.addField(new Field("parentbodyint", DataType.INT));
+ parentType.addField(new Field("parentheaderint", DataType.INT));
+ parentType.addField(new Field("overwritten", DataType.STRING));
DocumentType childType = new DocumentType("child");
- childType.addField(new Field("childbodyint", DataType.INT, false));
- childType.addField(new Field("childheaderint", DataType.INT, true));
- childType.addField(new Field("overwritten", DataType.INT, true));
+ childType.addField(new Field("childbodyint", DataType.INT));
+ childType.addField(new Field("childheaderint", DataType.INT));
+ childType.addField(new Field("overwritten", DataType.INT));
try {
childType.inherit(parentType);
fail("Inheritance with conflicting types worked.");
@@ -934,7 +934,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
public void testFieldValueImplementations() {
docMan = new DocumentTypeManager();
DocumentType docType = new DocumentType("impl");
- docType.addField(new Field("something", DataType.getArray(DataType.STRING), false));
+ docType.addField(new Field("something", DataType.getArray(DataType.STRING)));
docMan.register(docType);
//just checks that isAssignableFrom() in Document.setFieldValue() goes the right way
@@ -1276,9 +1276,9 @@ public class DocumentTestCase extends DocumentTestCaseBase {
public void testDocumentComparisonDoesNotCorruptStateBug6394548() {
DocumentTypeManager docMan = new DocumentTypeManager();
DocumentType docType = new DocumentType("bug2354045");
- docType.addField(new Field("string", 2, DataType.STRING, true));
- docType.addField(new Field("int", 1, DataType.INT, true));
- docType.addField(new Field("float", 0, DataType.FLOAT, true));
+ docType.addField(new Field("string", 2, DataType.STRING));
+ docType.addField(new Field("int", 1, DataType.INT));
+ docType.addField(new Field("float", 0, DataType.FLOAT));
docMan.register(docType);
Document doc1 = new Document(docType, new DocumentId("id:ns:bug2354045::bug6394548"));
diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java b/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java
index 68fe1c8cc57..6f95f77f08c 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java
@@ -23,14 +23,14 @@ public class DocumentTestCaseBase {
docMan = new DocumentTypeManager();
testDocType = new DocumentType("testdoc");
- testDocType.addHeaderField("byteattr", DataType.BYTE);
- testDocType.addHeaderField("intattr", DataType.INT);
+ testDocType.addField("byteattr", DataType.BYTE);
+ testDocType.addField("intattr", DataType.INT);
testDocType.addField("rawattr", DataType.RAW);
testDocType.addField("floatattr", DataType.FLOAT);
- testDocType.addHeaderField("stringattr", DataType.STRING);
- testDocType.addHeaderField("Minattr", DataType.INT);
- testDocType.addHeaderField("Minattr2", DataType.INT);
- testDocType.addHeaderField("primitive1", DataType.INT);
+ testDocType.addField("stringattr", DataType.STRING);
+ testDocType.addField("Minattr", DataType.INT);
+ testDocType.addField("Minattr2", DataType.INT);
+ testDocType.addField("primitive1", DataType.INT);
StructDataType sdt = new StructDataType("struct1");
sdt.addField(new Field("primitive1", DataType.INT));
diff --git a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
index 65c217e09e1..cac77dba434 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
@@ -30,7 +30,7 @@ public class DocumentTypeManagerTestCase {
DocumentType newDocType = new DocumentType("testdoc");
newDocType.addField("Fjomp", DataType.INT);
- newDocType.addHeaderField("Fjols", DataType.STRING);
+ newDocType.addField("Fjols", DataType.STRING);
manager.registerDocumentType(newDocType);
@@ -40,7 +40,6 @@ public class DocumentTypeManagerTestCase {
assertEquals("Fjomp", fetched4.getName());
assertEquals(fetched4.getDataType(), DataType.INT);
- assertEquals(fetched4.isHeader(), false);
}
@Test
@@ -64,8 +63,8 @@ public class DocumentTypeManagerTestCase {
StructDataType struct = new StructDataType("mystruct");
DataType wset1 = DataType.getWeightedSet(DataType.getArray(DataType.INT));
DataType wset2 = DataType.getWeightedSet(DataType.getArray(DataType.TAG));
- struct.addField(new Field("foo", wset1, true));
- struct.addField(new Field("bar", wset2, false));
+ struct.addField(new Field("foo", wset1));
+ struct.addField(new Field("bar", wset2));
DataType array = DataType.getArray(struct);
DocumentType docType = new DocumentType("mydoc");
docType.addField("hmm", array);
@@ -148,7 +147,6 @@ public class DocumentTypeManagerTestCase {
assertTrue(type.hasField("foobarfield1"));
Field foobarfield0 = type.getField("foobarfield0");
- assertTrue(!foobarfield0.isHeader());
assertTrue(foobarfield0.getDataType().getCode() == 2);
Field foobarfield1 = type.getField("foobarfield1");
@@ -190,7 +188,6 @@ public class DocumentTypeManagerTestCase {
assertTrue(type.hasField("arrayarrayfloat"));
Field arrayfloat = type.getField("arrayfloat");
- assertTrue(!arrayfloat.isHeader());
ArrayDataType dataType = (ArrayDataType) arrayfloat.getDataType();
assertTrue(dataType.getCode() == 99);
assertTrue(dataType.getValueClass().equals(Array.class));
@@ -200,7 +197,6 @@ public class DocumentTypeManagerTestCase {
Field arrayarrayfloat = type.getField("arrayarrayfloat");
ArrayDataType subType = (ArrayDataType) arrayarrayfloat.getDataType();
- assertTrue(!arrayarrayfloat.isHeader());
assertTrue(subType.getCode() == 4003);
assertTrue(subType.getValueClass().equals(Array.class));
assertTrue(subType.getNestedType().getCode() == 99);
@@ -218,14 +214,14 @@ public class DocumentTypeManagerTestCase {
DocumentType customtypes = manager.getDocumentType(new DataTypeName("customtypes"));
assertNull(banana.getField("newfield"));
- assertEquals(new Field("arrayfloat", 9489, new ArrayDataType(DataType.FLOAT, 99), false), customtypes.getField("arrayfloat"));
+ assertEquals(new Field("arrayfloat", 9489, new ArrayDataType(DataType.FLOAT, 99)), customtypes.getField("arrayfloat"));
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/document/documentmanager.updated.cfg");
banana = manager.getDocumentType(new DataTypeName("banana"));
customtypes = manager.getDocumentType(new DataTypeName("customtypes"));
- assertEquals(new Field("newfield", 12345, DataType.STRING, true), banana.getField("newfield"));
+ assertEquals(new Field("newfield", 12345, DataType.STRING), banana.getField("newfield"));
assertNull(customtypes.getField("arrayfloat"));
}
diff --git a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java
index c381a093b4e..9f05a4441b2 100644
--- a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java
@@ -799,8 +799,8 @@ public class DocumentUpdateTestCase {
public TensorUpdateSerializeFixture() {
docMan = new DocumentTypeManager();
docType = new DocumentType("test");
- docType.addHeaderField("sparse_tensor", new TensorDataType(TensorType.fromSpec("tensor(x{})")));
- docType.addHeaderField("dense_tensor", new TensorDataType(TensorType.fromSpec("tensor(x[4])")));
+ docType.addField("sparse_tensor", new TensorDataType(TensorType.fromSpec("tensor(x{})")));
+ docType.addField("dense_tensor", new TensorDataType(TensorType.fromSpec("tensor(x[4])")));
docMan.registerDocumentType(docType);
}
diff --git a/document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java b/document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java
index 286f7d72b24..7cf0adf6ed1 100644
--- a/document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java
+++ b/document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java
@@ -17,9 +17,9 @@ public class IncompatibleFieldTypesTest {
public void setUp() {
arrayOfStrings = new ArrayDataType(DataType.STRING);
struct = new StructDataType("fancypants");
- struct.addField(new Field("stringarray", arrayOfStrings, false));
+ struct.addField(new Field("stringarray", arrayOfStrings));
DataType weightedSetOfStrings = DataType.getWeightedSet(DataType.STRING, false, false);
- struct.addField(new Field("stringws", weightedSetOfStrings, false));
+ struct.addField(new Field("stringws", weightedSetOfStrings));
root = struct.createFieldValue();
root.setFieldValue("stringarray", arrayOfStrings.createFieldValue());
diff --git a/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java
index 4197938f0ee..295cfa37e89 100644
--- a/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java
+++ b/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java
@@ -20,14 +20,14 @@ public class StructTestCase {
@Test
public void testBasicStuff() throws Exception {
StructDataType type = new StructDataType("teststr");
- type.addField(new Field("int", 0, DataType.INT, true));
- type.addField(new Field("flt", 1, DataType.FLOAT, true));
- type.addField(new Field("str", 2, DataType.STRING, true));
- type.addField(new Field("raw", 3, DataType.RAW, true));
- type.addField(new Field("lng", 4, DataType.LONG, true));
- type.addField(new Field("dbl", 5, DataType.DOUBLE, true));
- type.addField(new Field("uri", 6, DataType.URI, true));
- type.addField(new Field("byt", 8, DataType.BYTE, true));
+ type.addField(new Field("int", 0, DataType.INT));
+ type.addField(new Field("flt", 1, DataType.FLOAT));
+ type.addField(new Field("str", 2, DataType.STRING));
+ type.addField(new Field("raw", 3, DataType.RAW));
+ type.addField(new Field("lng", 4, DataType.LONG));
+ type.addField(new Field("dbl", 5, DataType.DOUBLE));
+ type.addField(new Field("uri", 6, DataType.URI));
+ type.addField(new Field("byt", 8, DataType.BYTE));
Struct struct = new Struct(type);
{
@@ -236,7 +236,7 @@ public class StructTestCase {
@Test
public void testSetUnknownType() {
StructDataType type = new StructDataType("teststr");
- type.addField(new Field("int", 0, DataType.INT, true));
+ type.addField(new Field("int", 0, DataType.INT));
Struct struct = new Struct(type);
try {
@@ -251,9 +251,9 @@ public class StructTestCase {
public void testCompareToDoesNotMutateStateBug6394548() {
StructDataType type = new StructDataType("test");
// NOTE: non-increasing ID order!
- type.addField(new Field("int", 2, DataType.INT, true));
- type.addField(new Field("flt", 1, DataType.FLOAT, true));
- type.addField(new Field("str", 0, DataType.STRING, true));
+ type.addField(new Field("int", 2, DataType.INT));
+ type.addField(new Field("flt", 1, DataType.FLOAT));
+ type.addField(new Field("str", 0, DataType.STRING));
Struct a = new Struct(type);
a.setFieldValue("int", new IntegerFieldValue(123));
diff --git a/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java b/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java
index c11c58ff729..404b069277b 100644
--- a/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java
+++ b/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java
@@ -98,13 +98,13 @@ public class FieldSetTestCase extends DocumentTestCaseBase {
assertFalse(new DocIdOnly().contains(headerField));
assertTrue(new HeaderFields().contains(headerField));
- assertFalse(new HeaderFields().contains(bodyField));
+ assertTrue(new HeaderFields().contains(bodyField));
assertTrue(new HeaderFields().contains(new DocIdOnly()));
assertTrue(new HeaderFields().contains(new NoFields()));
- assertContains("[body]", "testdoc:rawattr");
+ assertNotContains("[body]", "testdoc:rawattr");
assertContains("[header]", "testdoc:intattr");
- assertNotContains("[header]", "testdoc:rawattr");
+ assertContains("[header]", "testdoc:rawattr");
assertContains("testdoc:rawattr,intattr", "testdoc:intattr");
assertNotContains("testdoc:intattr", "testdoc:rawattr,intattr");
assertContains("testdoc:intattr,rawattr", "testdoc:rawattr,intattr");
@@ -141,10 +141,10 @@ public class FieldSetTestCase extends DocumentTestCaseBase {
Document doc = getTestDocument();
doc.removeFieldValue("rawattr");
- assertEquals("floatattr:3.56", doCopyFields(doc, "[body]"));
- assertEquals("stringattr:tjohei,intattr:50,byteattr:30,floatattr:3.56", doCopyFields(doc, "[all]"));
- assertEquals("stringattr:tjohei,intattr:50,byteattr:30", doCopyFields(doc, "[header]"));
- assertEquals("byteattr:30,floatattr:3.56", doCopyFields(doc, "testdoc:floatattr,byteattr"));
+ assertEquals("", doCopyFields(doc, "[body]"));
+ assertEquals("floatattr:3.56,stringattr:tjohei,intattr:50,byteattr:30", doCopyFields(doc, "[header]"));
+ assertEquals("floatattr:3.56,stringattr:tjohei,intattr:50,byteattr:30", doCopyFields(doc, "[all]"));
+ assertEquals("floatattr:3.56,byteattr:30", doCopyFields(doc, "testdoc:floatattr,byteattr"));
}
String doStripFields(Document source, String fieldSet) {
@@ -159,10 +159,10 @@ public class FieldSetTestCase extends DocumentTestCaseBase {
Document doc = getTestDocument();
doc.removeFieldValue("rawattr");
- assertEquals("floatattr:3.56", doStripFields(doc, "[body]"));
- assertEquals("stringattr:tjohei,intattr:50,byteattr:30,floatattr:3.56", doStripFields(doc, "[all]"));
- assertEquals("stringattr:tjohei,intattr:50,byteattr:30", doStripFields(doc, "[header]"));
- assertEquals("byteattr:30,floatattr:3.56", doStripFields(doc, "testdoc:floatattr,byteattr"));
+ assertEquals("", doStripFields(doc, "[body]"));
+ assertEquals("floatattr:3.56,stringattr:tjohei,intattr:50,byteattr:30", doStripFields(doc, "[header]"));
+ assertEquals("floatattr:3.56,stringattr:tjohei,intattr:50,byteattr:30", doStripFields(doc, "[all]"));
+ assertEquals("floatattr:3.56,byteattr:30", doStripFields(doc, "testdoc:floatattr,byteattr"));
}
@Test
diff --git a/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java b/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java
index 0ff0bd81d90..b33d81ffdea 100644
--- a/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java
+++ b/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java
@@ -31,15 +31,15 @@ public class DocumentSelectorTestCase {
@Before
public void setUp() {
DocumentType type = new DocumentType("test");
- type.addHeaderField("hint", DataType.INT);
- type.addHeaderField("hfloat", DataType.FLOAT);
- type.addHeaderField("hstring", DataType.STRING);
+ type.addField("hint", DataType.INT);
+ type.addField("hfloat", DataType.FLOAT);
+ type.addField("hstring", DataType.STRING);
type.addField("content", DataType.STRING);
StructDataType mystruct = new StructDataType("mystruct");
- mystruct.addField(new Field("key", DataType.INT, false));
- mystruct.addField(new Field("value", DataType.STRING, false));
- type.addHeaderField("mystruct", mystruct);
+ mystruct.addField(new Field("key", DataType.INT));
+ mystruct.addField(new Field("value", DataType.STRING));
+ type.addField("mystruct", mystruct);
ArrayDataType structarray = new ArrayDataType(mystruct);
type.addField("structarray", structarray);