use of com.yahoo.document.DocumentType 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);
}
use of com.yahoo.document.DocumentType 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);
}
use of com.yahoo.document.DocumentType in project vespa by vespa-engine.
the class JsonWriterTestCase method readDocumentFromJson.
private Document readDocumentFromJson(String docId, String fields) throws IOException {
InputStream rawDoc = new ByteArrayInputStream(asFeed(docId, fields));
JsonReader r = new JsonReader(types, rawDoc, parserFactory);
DocumentParseInfo raw = r.parseDocument().get();
DocumentType docType = r.readDocumentType(raw.documentId);
DocumentPut put = new DocumentPut(new Document(docType, raw.documentId));
new VespaJsonDocumentReader().readPut(raw.fieldsBuffer, put);
return put.getDocument();
}
use of com.yahoo.document.DocumentType in project vespa by vespa-engine.
the class JsonWriterTestCase method registerTensorDocumentType.
private void registerTensorDocumentType() {
DocumentType x = new DocumentType("testtensor");
TensorType tensorType = new TensorType.Builder().mapped("x").mapped("y").build();
x.addField(new Field("tensorfield", new TensorDataType(tensorType)));
types.registerDocumentType(x);
}
use of com.yahoo.document.DocumentType in project vespa by vespa-engine.
the class Bug4475379TestCase method testClone.
@Test
public void testClone() {
DocumentTypeManager manager = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4475379.cfg");
DocumentType type = manager.getDocumentType("blog");
Document doc = new Document(type, "doc:this:is:a:test");
doc.setFieldValue("body", new StringFieldValue(""));
annotate(manager, doc);
Document anotherDoc = doc.clone();
assertThat(doc, equalTo(anotherDoc));
}
Aggregations