Search in sources :

Example 6 with ReferenceDataType

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

the class ReferenceFieldTestCase method assertSearchContainsReferenceField.

private static void assertSearchContainsReferenceField(String expectedFieldname, String referencedDocType, SDDocumentType documentType) {
    Field field = documentType.getDocumentType().getField(expectedFieldname);
    assertNotNull("Field does not exist in document type: " + expectedFieldname, field);
    DataType dataType = field.getDataType();
    assertThat(dataType, instanceOf(ReferenceDataType.class));
    ReferenceDataType refField = (ReferenceDataType) dataType;
    assertEquals(referencedDocType, refField.getTargetType().getName());
}
Also used : Field(com.yahoo.document.Field) ReferenceDataType(com.yahoo.document.ReferenceDataType) DataType(com.yahoo.document.DataType) ReferenceDataType(com.yahoo.document.ReferenceDataType)

Example 7 with ReferenceDataType

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

the class JsonWriterTestCase method registerReferenceDocumentType.

private void registerReferenceDocumentType() {
    DocumentType docTypeWithRef = new DocumentType("testrefs");
    ReferenceDataType type = ReferenceDataType.createWithInferredId(types.getDocumentType("smoke"));
    docTypeWithRef.addField(new Field("ref_field", type));
    types.registerDocumentType(docTypeWithRef);
}
Also used : Field(com.yahoo.document.Field) ReferenceDataType(com.yahoo.document.ReferenceDataType) DocumentType(com.yahoo.document.DocumentType)

Aggregations

ReferenceDataType (com.yahoo.document.ReferenceDataType)7 Field (com.yahoo.document.Field)4 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)3 DataType (com.yahoo.document.DataType)2 DocumentType (com.yahoo.document.DocumentType)2 StructDataType (com.yahoo.document.StructDataType)2 SDField (com.yahoo.searchdefinition.document.SDField)2 CollectionDataType (com.yahoo.document.CollectionDataType)1 MapDataType (com.yahoo.document.MapDataType)1 StructuredDataType (com.yahoo.document.StructuredDataType)1 TemporaryStructuredDataType (com.yahoo.document.TemporaryStructuredDataType)1 AnnotationReferenceDataType (com.yahoo.document.annotation.AnnotationReferenceDataType)1 FieldSets (com.yahoo.searchdefinition.FieldSets)1 TemporaryAnnotationReferenceDataType (com.yahoo.searchdefinition.document.annotation.TemporaryAnnotationReferenceDataType)1 SearchField (com.yahoo.vespa.documentmodel.SearchField)1 Test (org.junit.Test)1