use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class DocumentGenMojo method buildSearches.
private SearchBuilder buildSearches(File sdDir) {
File[] sdFiles = sdDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".sd");
}
});
SearchBuilder builder = new UnprocessingSearchBuilder();
for (File f : sdFiles) {
try {
long modTime = f.lastModified();
if (modTime > newestModifiedTime) {
newestModifiedTime = modTime;
}
builder.importFile(f.getAbsolutePath());
} catch (ParseException | IOException e) {
throw new IllegalArgumentException(e);
}
}
builder.build();
for (Search search : builder.getSearchList()) {
this.searches.put(search.getName(), search);
}
return builder;
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class DocumentGenTest method testComplex.
@Test
public void testComplex() throws MojoFailureException {
DocumentGenMojo mojo = new DocumentGenMojo();
mojo.execute(new File("etc/complex/"), new File("target/generated-test-sources/vespa-documentgen-plugin/"), "com.yahoo.vespa.document");
Map<String, Search> searches = mojo.getSearches();
assertEquals(searches.get("video").getDocument("video").getField("weight").getDataType(), DataType.FLOAT);
assertTrue(searches.get("book").getDocument("book").getField("mystruct").getDataType() instanceof StructDataType);
assertTrue(searches.get("book").getDocument("book").getField("mywsfloat").getDataType() instanceof WeightedSetDataType);
assertTrue(((WeightedSetDataType) (searches.get("book").getDocument("book").getField("mywsfloat").getDataType())).getNestedType() == DataType.FLOAT);
}
Aggregations