Search in sources :

Example 1 with RendererRegistry

use of com.yahoo.search.rendering.RendererRegistry in project vespa by vespa-engine.

the class ValidatePredicateSearcherTestCase method doSearch.

private static Result doSearch(ValidatePredicateSearcher searcher, String yqlQuery, String command) {
    QueryTree queryTree = new YqlParser(new ParserEnvironment()).parse(new Parsable().setQuery(yqlQuery));
    Query query = new Query();
    query.getModel().getQueryTree().setRoot(queryTree.getRoot());
    TreeMap<String, List<String>> masterClusters = new TreeMap<>();
    masterClusters.put("cluster", Arrays.asList("document"));
    SearchDefinition searchDefinition = new SearchDefinition("document");
    Index index = new Index("predicate_field");
    index.addCommand(command);
    searchDefinition.addIndex(index);
    Map<String, SearchDefinition> searchDefinitionMap = new HashMap<>();
    searchDefinitionMap.put("document", searchDefinition);
    IndexFacts indexFacts = new IndexFacts(new IndexModel(masterClusters, searchDefinitionMap, searchDefinition));
    Execution.Context context = new Execution.Context(null, indexFacts, null, new RendererRegistry(MoreExecutors.directExecutor()), new SimpleLinguistics());
    return new Execution(searcher, context).search(query);
}
Also used : Query(com.yahoo.search.Query) IndexFacts(com.yahoo.prelude.IndexFacts) Parsable(com.yahoo.search.query.parser.Parsable) Index(com.yahoo.prelude.Index) IndexModel(com.yahoo.prelude.IndexModel) SearchDefinition(com.yahoo.prelude.SearchDefinition) SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) YqlParser(com.yahoo.search.yql.YqlParser) Execution(com.yahoo.search.searchchain.Execution) QueryTree(com.yahoo.search.query.QueryTree) RendererRegistry(com.yahoo.search.rendering.RendererRegistry) ParserEnvironment(com.yahoo.search.query.parser.ParserEnvironment)

Example 2 with RendererRegistry

use of com.yahoo.search.rendering.RendererRegistry in project vespa by vespa-engine.

the class TilingTestCase method callSearchAndSetRenderer.

private Result callSearchAndSetRenderer(Chain<Searcher> chain, Query query) {
    Execution.Context context = new Execution.Context(null, null, null, new RendererRegistry(MoreExecutors.directExecutor()), new SimpleLinguistics());
    Result result = new Execution(chain, context).search(query);
    result.getTemplating().setRenderer(new SearchRendererAdaptor(new TiledTemplateSet()));
    return result;
}
Also used : SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) Execution(com.yahoo.search.searchchain.Execution) TiledTemplateSet(com.yahoo.prelude.templates.TiledTemplateSet) SearchRendererAdaptor(com.yahoo.prelude.templates.SearchRendererAdaptor) RendererRegistry(com.yahoo.search.rendering.RendererRegistry) Result(com.yahoo.search.Result)

Aggregations

SimpleLinguistics (com.yahoo.language.simple.SimpleLinguistics)2 RendererRegistry (com.yahoo.search.rendering.RendererRegistry)2 Execution (com.yahoo.search.searchchain.Execution)2 Index (com.yahoo.prelude.Index)1 IndexFacts (com.yahoo.prelude.IndexFacts)1 IndexModel (com.yahoo.prelude.IndexModel)1 SearchDefinition (com.yahoo.prelude.SearchDefinition)1 SearchRendererAdaptor (com.yahoo.prelude.templates.SearchRendererAdaptor)1 TiledTemplateSet (com.yahoo.prelude.templates.TiledTemplateSet)1 Query (com.yahoo.search.Query)1 Result (com.yahoo.search.Result)1 QueryTree (com.yahoo.search.query.QueryTree)1 Parsable (com.yahoo.search.query.parser.Parsable)1 ParserEnvironment (com.yahoo.search.query.parser.ParserEnvironment)1 YqlParser (com.yahoo.search.yql.YqlParser)1