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"));
}
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]);
}
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());
}
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());
}
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());
}
Aggregations