use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.
the class GroupingQueryParserTestCase method executeQuery.
private static List<GroupingRequest> executeQuery(String request, String continuation, String timeZone) {
Query query = new Query();
query.properties().set(GroupingQueryParser.PARAM_REQUEST, request);
query.properties().set(GroupingQueryParser.PARAM_CONTINUE, continuation);
query.properties().set(GroupingQueryParser.PARAM_TIMEZONE, timeZone);
new Execution(new GroupingQueryParser(), Execution.Context.createContextStub()).search(query);
return GroupingRequest.getRequests(query);
}
use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.
the class FederationSearcherTestCase method testTraceOneSourceNoCloning.
@Test
public void testTraceOneSourceNoCloning() {
Chain<Searcher> mainChain = twoTracingSources(true);
Query q = new Query(com.yahoo.search.test.QueryTestCase.httpEncode("?query=test&traceLevel=1&sources=source1"));
Execution execution = new Execution(mainChain, Execution.Context.createContextStub(chainRegistry, null));
Result result = execution.search(q);
assertNull(result.hits().getError());
TwoSourceChecker lookForTraces = new TwoSourceChecker();
execution.trace().accept(lookForTraces);
assertTrue(lookForTraces.traceFromSource1);
assertFalse(lookForTraces.traceFromSource2);
}
use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.
the class FederationSearcherTestCase method assertSelects.
private void assertSelects(String providerName, SearchChainRegistry registry) {
QueryProfile profile = new QueryProfile("test");
profile.set("source.news.provider", providerName, null);
Query query = new Query(QueryTestCase.httpEncode("?query=test&model.sources=news"), profile.compile(null));
Result result = new Execution(registry.getComponent("default"), Execution.Context.createContextStub(registry, null)).search(query);
assertEquals(1, result.hits().size());
assertNotNull(result.hits().get(providerName + ":1"));
}
use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.
the class FederationSearcherTestCase method twoTracingSources.
private Chain<Searcher> twoTracingSources(boolean strictContracts) {
addChained(new Searcher() {
@Override
public Result search(Query query, Execution execution) {
query.trace(SOURCE1, 1);
return execution.search(query);
}
}, SOURCE1);
addChained(new Searcher() {
@Override
public Result search(Query query, Execution execution) {
query.trace(SOURCE2, 1);
return execution.search(query);
}
}, SOURCE2);
Chain<Searcher> mainChain = new Chain<>("default", new FederationSearcher(new FederationConfig(builder), new StrictContractsConfig(new StrictContractsConfig.Builder().searchchains(strictContracts)), new ComponentRegistry<>()));
return mainChain;
}
use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.
the class FederationSearcherTestCase method testTraceTwoSources.
@Test
public void testTraceTwoSources() {
Chain<Searcher> mainChain = twoTracingSources(false);
Query q = new Query(com.yahoo.search.test.QueryTestCase.httpEncode("?query=test&traceLevel=1"));
Execution execution = new Execution(mainChain, Execution.Context.createContextStub(chainRegistry, null));
Result result = execution.search(q);
assertNull(result.hits().getError());
TwoSourceChecker lookForTraces = new TwoSourceChecker();
execution.trace().accept(lookForTraces);
assertTrue(lookForTraces.traceFromSource1);
assertTrue(lookForTraces.traceFromSource2);
}
Aggregations