use of com.yahoo.search.searchchain.testutil.DocumentSourceSearcher in project vespa by vespa-engine.
the class JuniperSearcherTestCase method createSearchChain.
/**
* Creates a search chain which always returns a result with one hit containing information given in this
*
* @param sdName the search definition type of the returned hit
* @param content the content of the "dynteaser" field of the returned hit
*/
private Chain<Searcher> createSearchChain(String sdName, String content) {
JuniperSearcher searcher = new JuniperSearcher(new ComponentId("test"), new QrSearchersConfig(new QrSearchersConfig.Builder()));
DocumentSourceSearcher docsource = new DocumentSourceSearcher();
addResult(new Query("?query=12"), sdName, content, docsource);
addResult(new Query("?query=12&bolding=false"), sdName, content, docsource);
return new Chain<Searcher>(searcher, docsource);
}
use of com.yahoo.search.searchchain.testutil.DocumentSourceSearcher in project vespa by vespa-engine.
the class QueryValidatingSearcherTestCase method testBasic.
public void testBasic() {
// Setup
Map<Searcher, Searcher> chained = new HashMap<>();
Query query = new Query("?query=test");
Result result = new Result(query);
result.hits().add(new Hit("ymail://1111111111/AQAAAP7JgwEAj6XjQQAAAO/+ggA=", 950));
Searcher validator = new QueryValidatingSearcher();
DocumentSourceSearcher source = new DocumentSourceSearcher();
chained.put(validator, source);
source.addResult(query, result);
// Exercise
Result returnedResult = doSearch(validator, query, 0, 10, chained);
// Validate
assertEquals(1, returnedResult.getHitCount());
assertNull(returnedResult.hits().getError());
returnedResult = doSearch(validator, query, 0, 1001, chained);
assertEquals(0, returnedResult.getConcreteHitCount());
assertEquals(4, returnedResult.hits().getError().getCode());
returnedResult = doSearch(validator, query, 1001, 10, chained);
assertEquals(0, returnedResult.getConcreteHitCount());
assertEquals(4, returnedResult.hits().getError().getCode());
}
use of com.yahoo.search.searchchain.testutil.DocumentSourceSearcher in project vespa by vespa-engine.
the class JSONDebugSearcherTestCase method makeSearchChain.
private Chain<Searcher> makeSearchChain(String content, Searcher dumper) {
DocumentSourceSearcher docsource = new DocumentSourceSearcher();
addResult(new Query(DUMPJSON), content, docsource);
addResult(new Query(NODUMPJSON), content, docsource);
return new Chain<>(dumper, docsource);
}
use of com.yahoo.search.searchchain.testutil.DocumentSourceSearcher in project vespa by vespa-engine.
the class YqlFieldAndSourceTestCase method setUp.
@Before
public void setUp() throws Exception {
Query query = new Query("?query=test");
Result result = new Result(query);
Hit hit = createHit("lastHit", .1d, FIELD1, FIELD2, FIELD3);
result.hits().add(hit);
DocumentSourceSearcher mockBackend = new DocumentSourceSearcher();
mockBackend.addResult(query, result);
mockBackend.addSummaryClassByCopy(DEFAULT_SUMMARY_CLASS, Arrays.asList(FIELD1, FIELD2));
mockBackend.addSummaryClassByCopy(Execution.ATTRIBUTEPREFETCH, Arrays.asList(FIELD2));
mockBackend.addSummaryClassByCopy(THIRD_OPTION, Arrays.asList(FIELD3));
DocumentdbInfoConfig config = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(buildDocumentdbArray()));
searchChain = new Chain<>(new FieldFiller(config), mockBackend);
context = Execution.Context.createContextStub(null);
execution = new Execution(searchChain, context);
}
use of com.yahoo.search.searchchain.testutil.DocumentSourceSearcher in project vespa by vespa-engine.
the class FieldFilterTestCase method setUp.
@Before
public void setUp() throws Exception {
Query query = new Query("?query=test");
Result result = new Result(query);
Hit hit = createHit("lastHit", .1d, FIELD_A, FIELD_B, FIELD_C);
result.hits().add(hit);
DocumentSourceSearcher mockBackend = new DocumentSourceSearcher();
mockBackend.addResult(query, result);
searchChain = new Chain<Searcher>(new FieldFilter(), mockBackend);
context = Execution.Context.createContextStub(null);
execution = new Execution(searchChain, context);
}
Aggregations