Search in sources :

Example 86 with Execution

use of com.yahoo.search.searchchain.Execution 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 87 with Execution

use of com.yahoo.search.searchchain.Execution 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 88 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class LegacyCombinatorTestCase method testReqAndRankAndNot.

public void testReqAndRankAndNot() {
    Query q = new Query("?query.yahoo=2&query.yahoo.defidx=1&query.yahoo.operator=not&query.juhu=b&query.juhu.defidx=nalle&query.juhu.operator=rank&query.bamse=z&query.bamse.defidx=y");
    Execution e = new Execution(searcher, Execution.Context.createContextStub(new IndexFacts()));
    e.search(q);
    assertEquals("+(RANK y:z nalle:b) -1:2", q.getModel().getQueryTree().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) IndexFacts(com.yahoo.prelude.IndexFacts)

Example 89 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class LegacyCombinatorTestCase method testReqAndRank.

public void testReqAndRank() {
    Query q = new Query("?query.juhu=b&query.juhu.defidx=nalle&query.juhu.operator=rank&query.bamse=z&query.bamse.defidx=y");
    Execution e = new Execution(searcher, Execution.Context.createContextStub(new IndexFacts()));
    e.search(q);
    assertEquals("RANK y:z nalle:b", q.getModel().getQueryTree().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) IndexFacts(com.yahoo.prelude.IndexFacts)

Example 90 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class LegacyCombinatorTestCase method testDefaultIndexWithoutQuery.

public void testDefaultIndexWithoutQuery() {
    Query q = new Query("?defidx.juhu=b");
    Execution e = new Execution(searcher, Execution.Context.createContextStub(new IndexFacts()));
    e.search(q);
    assertEquals("NULL", q.getModel().getQueryTree().toString());
    q = new Query("?query=a&defidx.juhu=b");
    e = new Execution(searcher, Execution.Context.createContextStub(new IndexFacts()));
    e.search(q);
    assertEquals("a", q.getModel().getQueryTree().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) IndexFacts(com.yahoo.prelude.IndexFacts)

Aggregations

Execution (com.yahoo.search.searchchain.Execution)232 Query (com.yahoo.search.Query)184 Result (com.yahoo.search.Result)127 Test (org.junit.Test)123 Searcher (com.yahoo.search.Searcher)88 Chain (com.yahoo.component.chain.Chain)59 IndexFacts (com.yahoo.prelude.IndexFacts)34 Hit (com.yahoo.search.result.Hit)25 FeedContext (com.yahoo.feedapi.FeedContext)20 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)20 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)20 ClusterList (com.yahoo.vespaclient.ClusterList)20 AndItem (com.yahoo.prelude.query.AndItem)18 WordItem (com.yahoo.prelude.query.WordItem)17 ComponentId (com.yahoo.component.ComponentId)13 GetDocumentReply (com.yahoo.documentapi.messagebus.protocol.GetDocumentReply)13 FastHit (com.yahoo.prelude.fastsearch.FastHit)13 FederationSearcher (com.yahoo.search.federation.FederationSearcher)13 ArrayList (java.util.ArrayList)12 CompositeItem (com.yahoo.prelude.query.CompositeItem)11