use of com.yahoo.prelude.fastsearch.test.fs4mock.MockBackend 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.prelude.fastsearch.test.fs4mock.MockBackend 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.prelude.fastsearch.test.fs4mock.MockBackend in project vespa by vespa-engine.
the class FastSearcherTestCase method testSinglePassGroupingIsForcedWithSingleNodeGroups.
@Test
public void testSinglePassGroupingIsForcedWithSingleNodeGroups() {
FastSearcher fastSearcher = new FastSearcher(new MockBackend(), new FS4ResourcePool(1), new MockDispatcher(new SearchCluster.Node("host0", 123, 0)), new SummaryParameters(null), new ClusterParams("testhittype"), new CacheParams(100, 1e64), documentdbInfoConfig);
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
GroupingRequest request2 = GroupingRequest.newInstance(q);
AllOperation all = new AllOperation();
all.addChild(new EachOperation());
all.addChild(new EachOperation());
request2.setRootOperation(all);
assertForceSinglePassIs(false, q);
fastSearcher.search(q, new Execution(Execution.Context.createContextStub()));
assertForceSinglePassIs(true, q);
}
use of com.yahoo.prelude.fastsearch.test.fs4mock.MockBackend in project vespa by vespa-engine.
the class FastSearcherTestCase method testNoNormalizing.
@Test
public void testNoNormalizing() {
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);
MockFSChannel.setEmptyDocsums(false);
// Default cache = 100Mb
assertEquals(100, fastSearcher.getCacheControl().capacity());
Result result = doSearch(fastSearcher, new Query("?query=ignored"), 0, 10);
assertTrue(result.hits().get(0).getRelevance().getScore() > 1000);
}
Aggregations