Search in sources :

Example 76 with Field

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

the class JsonWriterTestCase method registerSinglePositionDocumentType.

private void registerSinglePositionDocumentType() {
    DocumentType x = new DocumentType("testsinglepos");
    DataType d = PositionDataType.INSTANCE;
    x.addField(new Field("singlepos", 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)

Example 77 with Field

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

the class JsonWriterTestCase method registerRawDocumentType.

private void registerRawDocumentType() {
    DocumentType x = new DocumentType("testraw");
    DataType d = DataType.RAW;
    x.addField(new Field("actualraw", 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)

Example 78 with Field

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

the class PredicateFieldValueTest method requireThatSerializeCallsBackToWriter.

@Test
public void requireThatSerializeCallsBackToWriter() {
    Field field = Mockito.mock(Field.class);
    FieldWriter writer = Mockito.mock(FieldWriter.class);
    PredicateFieldValue value = new PredicateFieldValue(SimplePredicates.newPredicate());
    value.serialize(field, writer);
    Mockito.verify(writer).write(field, value);
}
Also used : Field(com.yahoo.document.Field) FieldWriter(com.yahoo.document.serialization.FieldWriter) Test(org.junit.Test)

Example 79 with Field

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

the class ReferenceFieldValueTestCase method createDocumentType.

private static DocumentType createDocumentType(String name) {
    DocumentType type = new DocumentType(name);
    type.addField(new Field("foo", DataType.STRING));
    return type;
}
Also used : Field(com.yahoo.document.Field) DocumentType(com.yahoo.document.DocumentType)

Example 80 with Field

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

the class StringTestCase method getAnnotationsForNode.

public void getAnnotationsForNode(SpanTree tree, SpanNode node) {
    Iterator<Annotation> iter = tree.iterator(node);
    boolean annotationPresent = false;
    while (iter.hasNext()) {
        annotationPresent = true;
        Annotation xx = iter.next();
        Struct fValue = (Struct) xx.getFieldValue();
        System.out.println("Annotation: " + xx);
        if (fValue == null) {
            System.out.println("Field Value is null");
            return;
        }
        Iterator fieldIter = fValue.iterator();
        while (fieldIter.hasNext()) {
            Map.Entry m = (Map.Entry) fieldIter.next();
            Field f = (Field) m.getKey();
            FieldValue val = (FieldValue) m.getValue();
            System.out.println("Field : " + f + " Value: " + val);
        }
    }
    if (!annotationPresent) {
        System.out.println("****No annotations found for the span node: " + node);
    }
}
Also used : Field(com.yahoo.document.Field) ListIterator(java.util.ListIterator) Iterator(java.util.Iterator) Map(java.util.Map) Annotation(com.yahoo.document.annotation.Annotation)

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