use of com.yahoo.prelude.IndexModel 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.IndexModel 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.IndexModel in project vespa by vespa-engine.
the class ParsingTester method createIndexFacts.
/**
* Returns an unfrozen version of the IndexFacts this will use.
* This can be used to add new indexes and passing the resulting IndexFacts to the constructor of this.
*/
public static IndexFacts createIndexFacts() {
String indexInfoConfigID = "file:src/test/java/com/yahoo/prelude/query/parser/test/parseindexinfo.cfg";
ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
IndexInfoConfig config = getter.getConfig(indexInfoConfigID);
return new IndexFacts(new IndexModel(config, (QrSearchersConfig) null));
}
use of com.yahoo.prelude.IndexModel 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);
}
use of com.yahoo.prelude.IndexModel in project vespa by vespa-engine.
the class SourceRefResolverTestCase method setupIndexFacts.
private static void setupIndexFacts() {
TreeMap<String, List<String>> masterClusters = new TreeMap<>();
masterClusters.put(cluster1, Arrays.asList("document1", "document2"));
masterClusters.put(cluster2, Arrays.asList("document1"));
masterClusters.put(cluster3, Arrays.asList("document3"));
indexFacts = new IndexFacts(new IndexModel(masterClusters, null, null));
}
Aggregations