use of com.yahoo.searchdefinition.parser.ParseException in project vespa by vespa-engine.
the class IndexingOperation method fromStream.
public static IndexingOperation fromStream(SimpleCharStream input, boolean multiLine, Linguistics linguistics) throws ParseException {
ScriptParserContext config = new ScriptParserContext(linguistics);
config.setAnnotatorConfig(new AnnotatorConfig());
config.setInputStream(input);
ScriptExpression exp;
try {
if (multiLine) {
exp = ScriptExpression.newInstance(config);
} else {
exp = new ScriptExpression(StatementExpression.newInstance(config));
}
} catch (com.yahoo.vespa.indexinglanguage.parser.ParseException e) {
ParseException t = new ParseException("Error reported by IL parser: " + e.getMessage());
t.initCause(e);
throw t;
}
return new IndexingOperation(exp);
}
use of com.yahoo.searchdefinition.parser.ParseException 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;
}
Aggregations