use of com.yahoo.prelude.SearchDefinition in project vespa by vespa-engine.
the class JuniperSearcherTestCase method createExecution.
private Execution createExecution(Chain<Searcher> chain) {
Map<String, List<String>> clusters = new LinkedHashMap<>();
Map<String, SearchDefinition> searchDefs = new LinkedHashMap<>();
searchDefs.put("one", createSearchDefinitionOne());
searchDefs.put("two", createSearchDefinitionTwo());
SearchDefinition union = new SearchDefinition("union");
IndexModel indexModel = new IndexModel(clusters, searchDefs, union);
return new Execution(chain, Execution.Context.createContextStub(new IndexFacts(indexModel)));
}
use of com.yahoo.prelude.SearchDefinition in project vespa by vespa-engine.
the class JuniperSearcherTestCase method createSearchDefinitionOne.
private SearchDefinition createSearchDefinitionOne() {
SearchDefinition one = new SearchDefinition("one");
Index dynteaser = new Index("dynteaser");
dynteaser.setDynamicSummary(true);
one.addIndex(dynteaser);
Index bigteaser = new Index("bigteaser");
dynteaser.setHighlightSummary(true);
one.addIndex(bigteaser);
Index otherteaser = new Index("otherteaser");
otherteaser.setDynamicSummary(true);
one.addIndex(otherteaser);
return one;
}
use of com.yahoo.prelude.SearchDefinition in project vespa by vespa-engine.
the class LiteralBoostSearcherTestCase method createSearchDefinitionWithFields.
private SearchDefinition createSearchDefinitionWithFields(String name, boolean literalBoost) {
SearchDefinition type = new SearchDefinition(name);
Index defaultIndex = new Index("default");
defaultIndex.setLiteralBoost(literalBoost);
type.addIndex(defaultIndex);
Index absoluteIndex = new Index("absolute");
absoluteIndex.setLiteralBoost(literalBoost);
type.addIndex(absoluteIndex);
return type;
}
use of com.yahoo.prelude.SearchDefinition in project vespa by vespa-engine.
the class ClusterSearcherTestCase method createIndexFacts.
private IndexFacts createIndexFacts() {
Map<String, List<String>> clusters = new LinkedHashMap<>();
clusters.put("cluster1", Arrays.asList("type1", "type2", "type3"));
clusters.put("cluster2", Arrays.asList("type4", "type5"));
clusters.put("type1", Arrays.asList("type6"));
Map<String, SearchDefinition> searchDefs = new LinkedHashMap<>();
searchDefs.put("type1", new SearchDefinition("type1"));
searchDefs.put("type2", new SearchDefinition("type2"));
searchDefs.put("type3", new SearchDefinition("type3"));
searchDefs.put("type4", new SearchDefinition("type4"));
searchDefs.put("type5", new SearchDefinition("type5"));
searchDefs.put("type6", new SearchDefinition("type6"));
SearchDefinition union = new SearchDefinition("union");
return new IndexFacts(new IndexModel(clusters, searchDefs, union));
}
use of com.yahoo.prelude.SearchDefinition 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);
}
Aggregations