use of com.yahoo.search.result.ErrorMessage in project vespa by vespa-engine.
the class FeedResponse method addError.
public FeedResponse addError(com.yahoo.container.protect.Error code, String error) {
errorMessages.add(new ErrorMessage(code.code, error));
errors.add(error);
return this;
}
use of com.yahoo.search.result.ErrorMessage in project vespa by vespa-engine.
the class FastSearcherTestCase method testNullQuery.
@Test
public void testNullQuery() {
Logger.getLogger(FastSearcher.class.getName()).setLevel(Level.ALL);
FastSearcher fastSearcher = new FastSearcher(new MockBackend(), new FS4ResourcePool(1), new MockDispatcher(Collections.emptyList()), new SummaryParameters(null), new ClusterParams("testhittype"), new CacheParams(100, 1e64), documentdbInfoConfig);
String query = "?junkparam=ignored";
Result result = doSearch(fastSearcher, new Query(query), 0, 10);
ErrorMessage message = result.hits().getError();
assertNotNull("Got error", message);
assertEquals("Null query", message.getMessage());
assertEquals(query, message.getDetailedMessage());
assertEquals(Error.NULL_QUERY.code, message.getCode());
}
use of com.yahoo.search.result.ErrorMessage in project vespa by vespa-engine.
the class FastSearcherTestCase method testDispatchDotSummaries.
@Test
public void testDispatchDotSummaries() {
Logger.getLogger(FastSearcher.class.getName()).setLevel(Level.ALL);
DocumentdbInfoConfig documentdbConfigWithOneDb = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("testDb").summaryclass(new DocumentdbInfoConfig.Documentdb.Summaryclass.Builder().name("simple").id(7)).rankprofile(new DocumentdbInfoConfig.Documentdb.Rankprofile.Builder().name("simpler").hasRankFeatures(false).hasSummaryFeatures(false))));
FastSearcher fastSearcher = new FastSearcher(new MockBackend(), new FS4ResourcePool(1), new MockDispatcher(Collections.emptyList()), new SummaryParameters(null), new ClusterParams("testhittype"), new CacheParams(100, 1e64), documentdbConfigWithOneDb);
String query = "?query=sddocname:a&dispatch.summaries";
Result result = doSearch(fastSearcher, new Query(query), 0, 10);
ErrorMessage message = result.hits().getError();
assertNotNull("Got error", message);
assertEquals("Invalid query parameter", message.getMessage());
assertEquals("When using dispatch.summaries and your summary/rankprofile require the query, you need to enable ranking.queryCache.", message.getDetailedMessage());
assertEquals(Error.INVALID_QUERY_PARAMETER.code, message.getCode());
query = "?query=sddocname:a&dispatch.summaries&ranking.queryCache";
result = doSearch(fastSearcher, new Query(query), 0, 10);
assertNull(result.hits().getError());
query = "?query=sddocname:a&dispatch.summaries&summary=simple&ranking=simpler";
result = doSearch(fastSearcher, new Query(query), 0, 10);
assertNull(result.hits().getError());
}
use of com.yahoo.search.result.ErrorMessage in project vespa by vespa-engine.
the class MinimalQueryInserterTestCase method testMaxOffset.
@Test
public void testMaxOffset() {
Query query = new Query("search/?yql=select%20*%20from%20sources%20*%20where%20title%20contains%20%22madonna%22%20limit%2040031offset%2040000%3B");
Result r = execution.search(query);
assertEquals(1, r.hits().getErrorHit().errors().size());
ErrorMessage e = r.hits().getErrorHit().errorIterator().next();
assertEquals(com.yahoo.container.protect.Error.INVALID_QUERY_PARAMETER.code, e.getCode());
assertTrue(e.getDetailedMessage().indexOf("max offset") >= 0);
}
use of com.yahoo.search.result.ErrorMessage in project vespa by vespa-engine.
the class MinimalQueryInserterTestCase method testMaxLimit.
@Test
public void testMaxLimit() {
Query query = new Query("search/?yql=select%20*%20from%20sources%20*%20where%20title%20contains%20%22madonna%22%20limit%2040000offset%207%3B");
Result r = execution.search(query);
assertEquals(1, r.hits().getErrorHit().errors().size());
ErrorMessage e = r.hits().getErrorHit().errorIterator().next();
assertEquals(com.yahoo.container.protect.Error.INVALID_QUERY_PARAMETER.code, e.getCode());
assertTrue(e.getDetailedMessage().indexOf("max hits") >= 0);
}
Aggregations