Search in sources :

Example 11 with Field

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

the class IndexSchemaTestCase method requireThatArrayOfStructWithArrayFieldIsFlattened.

@Test
public void requireThatArrayOfStructWithArrayFieldIsFlattened() {
    StructDataType type = new StructDataType("my_struct");
    type.addField(new Field("my_byte", DataType.getArray(DataType.BYTE)));
    type.addField(new Field("my_double", DataType.getArray(DataType.DOUBLE)));
    type.addField(new Field("my_float", DataType.getArray(DataType.FLOAT)));
    type.addField(new Field("my_int", DataType.getArray(DataType.INT)));
    type.addField(new Field("my_long", DataType.getArray(DataType.LONG)));
    type.addField(new Field("my_raw", DataType.getArray(DataType.RAW)));
    type.addField(new Field("my_string", DataType.getArray(DataType.STRING)));
    type.addField(new Field("my_uri", DataType.getArray(DataType.URI)));
    assertFlat(new Field("foo", DataType.getArray(type)), new Field("foo.my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))), new Field("foo.my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))), new Field("foo.my_float", DataType.getArray(DataType.getArray(DataType.FLOAT))), new Field("foo.my_int", DataType.getArray(DataType.getArray(DataType.INT))), new Field("foo.my_long", DataType.getArray(DataType.getArray(DataType.LONG))), new Field("foo.my_raw", DataType.getArray(DataType.getArray(DataType.RAW))), new Field("foo.my_string", DataType.getArray(DataType.getArray(DataType.STRING))), new Field("foo.my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
}
Also used : Field(com.yahoo.document.Field) StructDataType(com.yahoo.document.StructDataType) Test(org.junit.Test)

Example 12 with Field

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

the class IndexSchemaTestCase method requireThatPrimitiveIsNotFlattened.

@Test
public void requireThatPrimitiveIsNotFlattened() {
    assertFlat(new Field("foo", DataType.BYTE), new Field("foo", DataType.BYTE));
    assertFlat(new Field("foo", DataType.DOUBLE), new Field("foo", DataType.DOUBLE));
    assertFlat(new Field("foo", DataType.FLOAT), new Field("foo", DataType.FLOAT));
    assertFlat(new Field("foo", DataType.INT), new Field("foo", DataType.INT));
    assertFlat(new Field("foo", DataType.LONG), new Field("foo", DataType.LONG));
    assertFlat(new Field("foo", DataType.RAW), new Field("foo", DataType.RAW));
    assertFlat(new Field("foo", DataType.STRING), new Field("foo", DataType.STRING));
    assertFlat(new Field("foo", DataType.URI), new Field("foo", DataType.URI));
    assertFlat(new Field("foo", DataType.PREDICATE), new Field("foo", DataType.PREDICATE));
}
Also used : Field(com.yahoo.document.Field) Test(org.junit.Test)

Example 13 with Field

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

the class IndexSchemaTestCase method requireThatArrayOfPrimitiveIsNotFlattened.

@Test
public void requireThatArrayOfPrimitiveIsNotFlattened() {
    assertFlat(new Field("foo", DataType.getArray(DataType.BYTE)), new Field("foo", DataType.getArray(DataType.BYTE)));
    assertFlat(new Field("foo", DataType.getArray(DataType.DOUBLE)), new Field("foo", DataType.getArray(DataType.DOUBLE)));
    assertFlat(new Field("foo", DataType.getArray(DataType.FLOAT)), new Field("foo", DataType.getArray(DataType.FLOAT)));
    assertFlat(new Field("foo", DataType.getArray(DataType.INT)), new Field("foo", DataType.getArray(DataType.INT)));
    assertFlat(new Field("foo", DataType.getArray(DataType.LONG)), new Field("foo", DataType.getArray(DataType.LONG)));
    assertFlat(new Field("foo", DataType.getArray(DataType.RAW)), new Field("foo", DataType.getArray(DataType.RAW)));
    assertFlat(new Field("foo", DataType.getArray(DataType.STRING)), new Field("foo", DataType.getArray(DataType.STRING)));
    assertFlat(new Field("foo", DataType.getArray(DataType.URI)), new Field("foo", DataType.getArray(DataType.URI)));
    assertFlat(new Field("foo", DataType.getArray(DataType.PREDICATE)), new Field("foo", DataType.getArray(DataType.PREDICATE)));
}
Also used : Field(com.yahoo.document.Field) Test(org.junit.Test)

Example 14 with Field

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

the class IndexSchemaTestCase method requireThatStructIsFlattened.

@Test
public void requireThatStructIsFlattened() {
    StructDataType type = new StructDataType("my_struct");
    type.addField(new Field("my_byte", DataType.BYTE));
    type.addField(new Field("my_double", DataType.DOUBLE));
    type.addField(new Field("my_float", DataType.FLOAT));
    type.addField(new Field("my_int", DataType.INT));
    type.addField(new Field("my_long", DataType.LONG));
    type.addField(new Field("my_raw", DataType.RAW));
    type.addField(new Field("my_string", DataType.STRING));
    type.addField(new Field("my_uri", DataType.URI));
    assertFlat(new Field("foo", type), new Field("foo.my_byte", DataType.BYTE), new Field("foo.my_double", DataType.DOUBLE), new Field("foo.my_float", DataType.FLOAT), new Field("foo.my_int", DataType.INT), new Field("foo.my_long", DataType.LONG), new Field("foo.my_raw", DataType.RAW), new Field("foo.my_string", DataType.STRING), new Field("foo.my_uri", DataType.URI));
}
Also used : Field(com.yahoo.document.Field) StructDataType(com.yahoo.document.StructDataType) Test(org.junit.Test)

Example 15 with Field

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

the class IndexSchemaTestCase method requireThatArrayOfArrayOfStructIsFlattened.

@Test
public void requireThatArrayOfArrayOfStructIsFlattened() {
    StructDataType type = new StructDataType("my_struct");
    type.addField(new Field("my_byte", DataType.BYTE));
    type.addField(new Field("my_double", DataType.DOUBLE));
    type.addField(new Field("my_float", DataType.FLOAT));
    type.addField(new Field("my_int", DataType.INT));
    type.addField(new Field("my_long", DataType.LONG));
    type.addField(new Field("my_raw", DataType.RAW));
    type.addField(new Field("my_string", DataType.STRING));
    type.addField(new Field("my_uri", DataType.URI));
    assertFlat(new Field("foo", DataType.getArray(DataType.getArray(type))), new Field("foo.my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))), new Field("foo.my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))), new Field("foo.my_float", DataType.getArray(DataType.getArray(DataType.FLOAT))), new Field("foo.my_int", DataType.getArray(DataType.getArray(DataType.INT))), new Field("foo.my_long", DataType.getArray(DataType.getArray(DataType.LONG))), new Field("foo.my_raw", DataType.getArray(DataType.getArray(DataType.RAW))), new Field("foo.my_string", DataType.getArray(DataType.getArray(DataType.STRING))), new Field("foo.my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
}
Also used : Field(com.yahoo.document.Field) StructDataType(com.yahoo.document.StructDataType) Test(org.junit.Test)

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