use of com.yahoo.prelude.searcher.QueryValidatingSearcher 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());
}
Aggregations