use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class ExecutionTestCase method testBasicFill.
@Test
public void testBasicFill() {
Chain<Searcher> chain = new Chain<Searcher>(new FillableResultSearcher());
Execution execution = new Execution(chain, Execution.Context.createContextStub(null));
Result result = execution.search(new Query(com.yahoo.search.test.QueryTestCase.httpEncode("?presentation.summary=all")));
assertNotNull(result.hits().get("a"));
assertNull(result.hits().get("a").getField("filled"));
execution.fill(result);
assertTrue((Boolean) result.hits().get("a").getField("filled"));
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class ExecutionTestCase method testContextCacheSingleLengthSearchChain.
public void testContextCacheSingleLengthSearchChain() {
IndexFacts[] contextsBefore = new IndexFacts[1];
IndexFacts[] contextsAfter = new IndexFacts[1];
List<Searcher> l = new ArrayList<>(1);
l.add(new ContextCacheSearcher(0, contextsBefore, contextsAfter));
Chain<Searcher> chain = new Chain<>(l);
Query query = new Query("?mutatecontext=0");
new Execution(chain, Execution.Context.createContextStub()).search(query);
assertEquals(contextsBefore[0], contextsAfter[0]);
assertSame(contextsBefore[0], contextsAfter[0]);
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class SearchChainTestCase method searcherNames.
public List<String> searcherNames(Collection<Searcher> searchers) {
List<String> names = new ArrayList<>();
for (Searcher searcher : searchers) {
names.add(searcher.getId().stringValue());
}
Collections.sort(names);
return names;
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class ElapsedTimeTestCase method testBasicBreakdown.
public void testBasicBreakdown() {
TimeTracker t = new TimeTracker(new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third")));
t.injectTimeSource(new CreativeTimeSource(new long[] { 1L, 2L, 3L, 4L, 5L, 6L, 7L }));
t.sampleSearch(0, true);
t.sampleSearch(1, true);
t.sampleSearch(2, true);
t.sampleSearch(3, true);
t.sampleSearchReturn(2, true, null);
t.sampleSearchReturn(1, true, null);
t.sampleSearchReturn(0, true, null);
SearcherTimer[] searchers = t.searcherTracking();
checkTiming(searchers);
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class ElapsedTimeTestCase method testReportGeneration.
public void testReportGeneration() {
TimeTracker t = new TimeTracker(new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third")));
runSomeTraffic(t);
ElapsedTime elapsed = new ElapsedTime();
elapsed.add(t);
t = new TimeTracker(new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third")));
runSomeTraffic(t);
elapsed.add(t);
assertEquals(true, elapsed.hasDetailedData());
assertEquals("Time use per searcher:" + " first(QueryProcessing(SEARCH: 2 ms), ResultProcessing(SEARCH: 4 ms, FILL: 4 ms)),\n" + " second(QueryProcessing(SEARCH: 4 ms, FILL: 4 ms), ResultProcessing(SEARCH: 4 ms, FILL: 4 ms)),\n" + " third(QueryProcessing(SEARCH: 4 ms, FILL: 4 ms), ResultProcessing()).", elapsed.detailedReport());
}
Aggregations