use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class InheritanceTestCase method requireThatStructTypesAreInheritedFromGrandParent.
@Test
public void requireThatStructTypesAreInheritedFromGrandParent() throws IOException, ParseException {
String dir = "src/test/derived/inheritfromgrandparent/";
SearchBuilder builder = new SearchBuilder();
builder.importFile(dir + "grandparent.sd");
builder.importFile(dir + "parent.sd");
builder.importFile(dir + "child.sd");
builder.build();
derive("inheritfromgrandparent", builder, builder.getSearch("child"));
assertCorrectConfigFiles("inheritfromgrandparent");
}
use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class ImportedFieldsTestCase method buildAdSearch.
private static Search buildAdSearch(String sdContent) throws ParseException {
SearchBuilder builder = new SearchBuilder();
builder.importString(joinLines("search campaign {", " document campaign {", " field budget type int { indexing: attribute }", " }", "}"));
builder.importString(joinLines("search person {", " document person {", " field name type string { indexing: attribute }", " }", "}"));
builder.importString(sdContent);
builder.build();
return builder.getSearch("ad");
}
use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class DocumentDeriverTestCase method testDocumentDeriving.
@Test
public void testDocumentDeriving() {
String root = "src/test/derived/documentderiver/";
List<String> files = new ArrayList<>();
files.add(root + "newsarticle.sd");
files.add(root + "newssummary.sd");
files.add(root + "music.sd");
files.add(root + "mail.sd");
files.add(root + "compression_header.sd");
files.add(root + "compression_both.sd");
files.add(root + "compression_body.sd");
File toDir = new File("temp/documentderiver/");
toDir.mkdir();
SearchBuilder builder = Deriver.deriveDocuments(files, toDir.getPath());
try {
assertEqualFiles(root + "documentmanager.cfg", toDir.getPath() + "/documentmanager.cfg");
} catch (IOException e) {
throw new RuntimeException("Exception while comparing files", e);
}
SDDocumentType doc = builder.getSearch("newsarticle").getDocument();
assertNotNull(doc);
}
use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class DocumentModelBuilderTestCase method testMultipleInheritanceArray.
@Test
public void testMultipleInheritanceArray() throws IOException, ParseException {
SearchBuilder search = new SearchBuilder();
search.importFile("src/test/cfg/search/data/travel/searchdefinitions/TTData.sd");
search.importFile("src/test/cfg/search/data/travel/searchdefinitions/TTEdge.sd");
search.importFile("src/test/cfg/search/data/travel/searchdefinitions/TTPOI.sd");
search.build();
}
use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class DocumentModelBuilderTestCase method createAndTestModel.
private DocumentModel createAndTestModel(String sd) throws IOException, ParseException {
SearchBuilder search = SearchBuilder.createFromFile(sd);
DocumentModel model = search.getModel();
assertEquals(2, model.getDocumentManager().getTypes().size());
assertNotNull(model.getDocumentManager().getDocumentType("document"));
assertNotNull(model.getDocumentManager().getDocumentType("types"));
return model;
}
Aggregations