Search in sources :

Example 56 with Searcher

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"));
}
Also used : Chain(com.yahoo.component.chain.Chain) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) Searcher(com.yahoo.search.Searcher) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 57 with Searcher

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]);
}
Also used : Chain(com.yahoo.component.chain.Chain) Execution(com.yahoo.search.searchchain.Execution) IndexFacts(com.yahoo.prelude.IndexFacts) Query(com.yahoo.search.Query) Searcher(com.yahoo.search.Searcher) ArrayList(java.util.ArrayList)

Example 58 with Searcher

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;
}
Also used : Searcher(com.yahoo.search.Searcher) ArrayList(java.util.ArrayList)

Example 59 with Searcher

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);
}
Also used : TimeTracker(com.yahoo.search.statistics.TimeTracker) Searcher(com.yahoo.search.Searcher) SearcherTimer(com.yahoo.search.statistics.TimeTracker.SearcherTimer)

Example 60 with Searcher

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());
}
Also used : Chain(com.yahoo.component.chain.Chain) TimeTracker(com.yahoo.search.statistics.TimeTracker) Searcher(com.yahoo.search.Searcher) ElapsedTime(com.yahoo.search.statistics.ElapsedTime)

Aggregations

Searcher (com.yahoo.search.Searcher)130 Result (com.yahoo.search.Result)94 Execution (com.yahoo.search.searchchain.Execution)88 Query (com.yahoo.search.Query)82 Test (org.junit.Test)74 Chain (com.yahoo.component.chain.Chain)57 FeedContext (com.yahoo.feedapi.FeedContext)20 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)20 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)20 ClusterList (com.yahoo.vespaclient.ClusterList)20 Hit (com.yahoo.search.result.Hit)17 DocumentSourceSearcher (com.yahoo.search.searchchain.testutil.DocumentSourceSearcher)14 HashMap (java.util.HashMap)14 GetDocumentReply (com.yahoo.documentapi.messagebus.protocol.GetDocumentReply)13 FederationSearcher (com.yahoo.search.federation.FederationSearcher)11 FieldCollapsingSearcher (com.yahoo.prelude.searcher.FieldCollapsingSearcher)10 ArrayList (java.util.ArrayList)10 AsyncExecution (com.yahoo.search.searchchain.AsyncExecution)9 ComponentId (com.yahoo.component.ComponentId)8 FastHit (com.yahoo.prelude.fastsearch.FastHit)8