Search in sources :

Example 6 with ParseException

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);
}
Also used : AnnotatorConfig(com.yahoo.vespa.indexinglanguage.linguistics.AnnotatorConfig) ParseException(com.yahoo.searchdefinition.parser.ParseException) ScriptParserContext(com.yahoo.vespa.indexinglanguage.ScriptParserContext) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression)

Example 7 with ParseException

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;
}
Also used : UnprocessingSearchBuilder(com.yahoo.searchdefinition.UnprocessingSearchBuilder) Search(com.yahoo.searchdefinition.Search) UnprocessingSearchBuilder(com.yahoo.searchdefinition.UnprocessingSearchBuilder) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) ParseException(com.yahoo.searchdefinition.parser.ParseException)

Aggregations

ParseException (com.yahoo.searchdefinition.parser.ParseException)7 SearchBuilder (com.yahoo.searchdefinition.SearchBuilder)3 UnprocessingSearchBuilder (com.yahoo.searchdefinition.UnprocessingSearchBuilder)3 IOException (java.io.IOException)3 NamedReader (com.yahoo.io.reader.NamedReader)2 SDParser (com.yahoo.searchdefinition.parser.SDParser)2 SimpleCharStream (com.yahoo.searchdefinition.parser.SimpleCharStream)2 TokenMgrError (com.yahoo.searchdefinition.parser.TokenMgrError)2 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 DeployLogger (com.yahoo.config.application.api.DeployLogger)1 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)1 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)1 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)1 IOUtils (com.yahoo.io.IOUtils)1 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)1 Search (com.yahoo.searchdefinition.Search)1 SearchOrderer (com.yahoo.searchdefinition.derived.SearchOrderer)1 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)1 Processing (com.yahoo.searchdefinition.processing.Processing)1 DocumentModel (com.yahoo.vespa.documentmodel.DocumentModel)1