Search in sources :

Example 1 with UnprocessingSearchBuilder

use of com.yahoo.searchdefinition.UnprocessingSearchBuilder 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;
}
Also used : UnprocessingSearchBuilder(com.yahoo.searchdefinition.UnprocessingSearchBuilder) UnprocessingSearchBuilder(com.yahoo.searchdefinition.UnprocessingSearchBuilder) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) ParseException(com.yahoo.searchdefinition.parser.ParseException) IOException(java.io.IOException)

Example 2 with UnprocessingSearchBuilder

use of com.yahoo.searchdefinition.UnprocessingSearchBuilder 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

SearchBuilder (com.yahoo.searchdefinition.SearchBuilder)2 UnprocessingSearchBuilder (com.yahoo.searchdefinition.UnprocessingSearchBuilder)2 ParseException (com.yahoo.searchdefinition.parser.ParseException)2 Search (com.yahoo.searchdefinition.Search)1 IOException (java.io.IOException)1