Search in sources :

Example 36 with SearchBuilder

use of com.yahoo.searchdefinition.SearchBuilder 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)36 Test (org.junit.Test)24 Search (com.yahoo.searchdefinition.Search)6 UnprocessingSearchBuilder (com.yahoo.searchdefinition.UnprocessingSearchBuilder)6 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)4 IOException (java.io.IOException)4 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)3 RankProfile (com.yahoo.searchdefinition.RankProfile)3 ParseException (com.yahoo.searchdefinition.parser.ParseException)3 File (java.io.File)3 DocumentmanagerConfig (com.yahoo.document.config.DocumentmanagerConfig)2 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)2 DocumentManager (com.yahoo.vespa.configmodel.producers.DocumentManager)2 Pair (com.yahoo.collections.Pair)1 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)1 DocumenttypesConfig (com.yahoo.document.DocumenttypesConfig)1 AnnotationType (com.yahoo.document.annotation.AnnotationType)1 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)1 DocumentGraphValidator (com.yahoo.searchdefinition.DocumentGraphValidator)1 AttributeFields (com.yahoo.searchdefinition.derived.AttributeFields)1