use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class Deriver method getUnprocessingSearchBuilder.
public static SearchBuilder getUnprocessingSearchBuilder(List<String> sds) {
SearchBuilder builder = new UnprocessingSearchBuilder();
try {
for (String s : sds) {
builder.importFile(s);
}
} catch (ParseException | IOException e) {
throw new IllegalArgumentException(e);
}
builder.build();
return builder;
}
use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class Deriver method getSearchBuilder.
public static SearchBuilder getSearchBuilder(List<String> sds) {
SearchBuilder builder = new SearchBuilder();
try {
for (String s : sds) {
builder.importFile(s);
}
} catch (ParseException | IOException e) {
throw new IllegalArgumentException(e);
}
builder.build();
return builder;
}
use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class MailTestCase method testMail.
@Test
public void testMail() throws IOException, ParseException {
String dir = "src/test/derived/mail/";
SearchBuilder sb = new SearchBuilder();
sb.importFile(dir + "mail.sd");
assertCorrectDeriving(sb, dir);
}
use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class InheritanceTestCase method requireThatStructTypesAreInheritedThroughDiamond.
@Test
public void requireThatStructTypesAreInheritedThroughDiamond() throws IOException, ParseException {
String dir = "src/test/derived/inheritdiamond/";
List<String> files = Arrays.asList("grandparent.sd", "mother.sd", "father.sd", "child.sd");
File outDir = tmpDir.newFolder("out");
for (int startIdx = 0; startIdx < files.size(); ++startIdx) {
SearchBuilder builder = new SearchBuilder();
for (int fileIdx = startIdx; fileIdx < startIdx + files.size(); ++fileIdx) {
String fileName = files.get(fileIdx % files.size());
builder.importFile(dir + fileName);
}
builder.build();
DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder();
DerivedConfiguration.exportDocuments(new DocumentManager().produce(builder.getModel(), b), outDir.getPath());
DocumentmanagerConfig dc = new DocumentmanagerConfig(b);
assertEquals(17, dc.datatype().size());
assertNotNull(structType("child.body", dc));
DocumentmanagerConfig.Datatype.Structtype childHeader = structType("child.header", dc);
assertEquals(childHeader.field(0).name(), "foo");
assertEquals(childHeader.field(1).name(), "bar");
assertEquals(childHeader.field(2).name(), "baz");
assertEquals(childHeader.field(3).name(), "cox");
DocumentmanagerConfig.Datatype.Documenttype child = documentType("child", dc);
assertEquals(child.inherits(0).name(), "document");
assertEquals(child.inherits(1).name(), "father");
assertEquals(child.inherits(2).name(), "mother");
DocumentmanagerConfig.Datatype.Documenttype mother = documentType("mother", dc);
assertEquals(mother.inherits(0).name(), "grandparent");
assertEquals(mother.inherits(1).name(), "document");
}
}
use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.
the class InheritanceTestCase method requireThatIndexedStructFieldCanBeInherited.
@Test
public void requireThatIndexedStructFieldCanBeInherited() throws IOException, ParseException {
String dir = "src/test/derived/inheritstruct/";
SearchBuilder builder = new SearchBuilder();
builder.importFile(dir + "parent.sd");
builder.importFile(dir + "child.sd");
builder.build();
derive("inheritstruct", builder, builder.getSearch("child"));
assertCorrectConfigFiles("inheritstruct");
}
Aggregations