Search in sources :

Example 31 with Field

use of com.yahoo.document.Field in project vespa by vespa-engine.

the class VespaXmlUpdateReaderTestCase method requireThatStructFieldDeserializeExceptionIncludesFieldName.

@Test
public void requireThatStructFieldDeserializeExceptionIncludesFieldName() throws Exception {
    StructDataType structType = new StructDataType("my_struct");
    structType.addField(new Field("my_byte", DataType.BYTE));
    Field field = new Field("my_field", structType);
    assertThrows(field, "<assign field='my_field'><my_byte>-129</my_byte></assign>", "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 89)");
    assertThrows(field, "<assign fieldpath='my_field'><my_byte>-129</my_byte></assign>", "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 93)");
    assertThrows(field, "<add field='my_field'><my_byte>-129</my_byte></add>", "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 86)");
    assertThrows(field, "<add fieldpath='my_field'><my_byte>-129</my_byte></add>", "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 90)");
    assertThrows(field, "<remove field='my_field'><my_byte>-129</my_byte></remove>", "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 89)");
}
Also used : Field(com.yahoo.document.Field) StructDataType(com.yahoo.document.StructDataType) Test(org.junit.Test)

Example 32 with Field

use of com.yahoo.document.Field in project vespa by vespa-engine.

the class JsonWriterTestCase method registerArrayDocumentType.

private void registerArrayDocumentType() {
    DocumentType x = new DocumentType("testarray");
    DataType d = new ArrayDataType(DataType.STRING);
    x.addField(new Field("actualarray", d));
    types.registerDocumentType(x);
}
Also used : Field(com.yahoo.document.Field) DocumentType(com.yahoo.document.DocumentType) DataType(com.yahoo.document.DataType) ArrayDataType(com.yahoo.document.ArrayDataType) StructDataType(com.yahoo.document.StructDataType) MapDataType(com.yahoo.document.MapDataType) PositionDataType(com.yahoo.document.PositionDataType) TensorDataType(com.yahoo.document.TensorDataType) WeightedSetDataType(com.yahoo.document.WeightedSetDataType) ReferenceDataType(com.yahoo.document.ReferenceDataType) ArrayDataType(com.yahoo.document.ArrayDataType)

Example 33 with Field

use of com.yahoo.document.Field in project vespa by vespa-engine.

the class JsonWriterTestCase method registerSmokeDocumentType.

private void registerSmokeDocumentType() {
    DocumentType x = new DocumentType("smoke");
    x.addField(new Field("something", DataType.STRING));
    x.addField(new Field("nalle", DataType.STRING));
    types.registerDocumentType(x);
}
Also used : Field(com.yahoo.document.Field) DocumentType(com.yahoo.document.DocumentType)

Example 34 with Field

use of com.yahoo.document.Field in project vespa by vespa-engine.

the class JsonWriterTestCase method registerMapDocumentType.

private void registerMapDocumentType() {
    DocumentType x = new DocumentType("testmap");
    DataType d = new MapDataType(DataType.STRING, DataType.STRING);
    x.addField(new Field("actualmap", d));
    types.registerDocumentType(x);
}
Also used : Field(com.yahoo.document.Field) DocumentType(com.yahoo.document.DocumentType) DataType(com.yahoo.document.DataType) ArrayDataType(com.yahoo.document.ArrayDataType) StructDataType(com.yahoo.document.StructDataType) MapDataType(com.yahoo.document.MapDataType) PositionDataType(com.yahoo.document.PositionDataType) TensorDataType(com.yahoo.document.TensorDataType) WeightedSetDataType(com.yahoo.document.WeightedSetDataType) ReferenceDataType(com.yahoo.document.ReferenceDataType) MapDataType(com.yahoo.document.MapDataType)

Example 35 with Field

use of com.yahoo.document.Field in project vespa by vespa-engine.

the class JsonWriterTestCase method registerPredicateDocumentType.

private void registerPredicateDocumentType() {
    DocumentType x = new DocumentType("testpredicate");
    DataType d = DataType.PREDICATE;
    x.addField(new Field("actualpredicate", d));
    types.registerDocumentType(x);
}
Also used : Field(com.yahoo.document.Field) DocumentType(com.yahoo.document.DocumentType) DataType(com.yahoo.document.DataType) ArrayDataType(com.yahoo.document.ArrayDataType) StructDataType(com.yahoo.document.StructDataType) MapDataType(com.yahoo.document.MapDataType) PositionDataType(com.yahoo.document.PositionDataType) TensorDataType(com.yahoo.document.TensorDataType) WeightedSetDataType(com.yahoo.document.WeightedSetDataType) ReferenceDataType(com.yahoo.document.ReferenceDataType)

Aggregations

Field (com.yahoo.document.Field)115 Test (org.junit.Test)50 StructDataType (com.yahoo.document.StructDataType)46 DocumentType (com.yahoo.document.DocumentType)24 DataType (com.yahoo.document.DataType)17 SimpleTestAdapter (com.yahoo.vespa.indexinglanguage.SimpleTestAdapter)14 ReferenceDataType (com.yahoo.document.ReferenceDataType)13 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)13 ArrayDataType (com.yahoo.document.ArrayDataType)12 MapDataType (com.yahoo.document.MapDataType)12 TensorDataType (com.yahoo.document.TensorDataType)11 WeightedSetDataType (com.yahoo.document.WeightedSetDataType)11 SDField (com.yahoo.searchdefinition.document.SDField)10 PositionDataType (com.yahoo.document.PositionDataType)9 FieldValue (com.yahoo.document.datatypes.FieldValue)9 IntegerFieldValue (com.yahoo.document.datatypes.IntegerFieldValue)9 GrowableByteBuffer (com.yahoo.io.GrowableByteBuffer)8 Struct (com.yahoo.document.datatypes.Struct)7 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)6 Document (com.yahoo.document.Document)5