use of com.yahoo.prelude.fastsearch.DocumentdbInfoConfig in project vespa by vespa-engine.
the class VdsStreamingSearcherTestCase method testBasics.
@Test
public void testBasics() {
MockVisitorFactory factory = new MockVisitorFactory();
VdsStreamingSearcher searcher = new VdsStreamingSearcher(factory);
ConfigGetter<DocumentdbInfoConfig> getter = new ConfigGetter<>(DocumentdbInfoConfig.class);
DocumentdbInfoConfig config = getter.getConfig("file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg");
searcher.init(new SummaryParameters("default"), new ClusterParams("clusterName"), new CacheParams(100, 1e64), config);
// Magic query values are used to trigger specific behaviors from mock visitor.
checkError(searcher, "/?query=noselection", "Backend communication error", "Streaming search needs one and only one");
checkError(searcher, "/?streaming.userid=1&query=parseexception", "Backend communication error", "Failed to parse document selection string");
checkError(searcher, "/?streaming.userid=1&query=tokenizeexception", "Backend communication error", "Failed to tokenize document selection string");
checkError(searcher, "/?streaming.userid=1&query=interruptedexception", "Backend communication error", "Interrupted");
checkError(searcher, "/?streaming.userid=1&query=timeoutexception", "Timed out", "Timed out");
checkError(searcher, "/?streaming.userid=1&query=illegalargumentexception", "Backend communication error", "Illegal argument");
checkError(searcher, "/?streaming.userid=1&query=nosummary", "Backend communication error", "Did not find summary for hit with document id");
checkError(searcher, "/?streaming.userid=1&query=nosummarytofill", "Timed out", "Missing hit summary data for 1 hits");
checkSearch(searcher, "/?streaming.userid=1&query=oneuserhit", 1, USERDOC_ID_PREFIX);
checkSearch(searcher, "/?streaming.userid=1&query=oneuserhit&sorting=%2Bsurname", 1, USERDOC_ID_PREFIX);
checkSearch(searcher, "/?streaming.selection=id.user%3D%3d1&query=twouserhits", 2, USERDOC_ID_PREFIX);
checkSearch(searcher, "/?streaming.groupname=group1&query=twogrouphitsandoneuserhit", 2, GROUPDOC_ID_PREFIX);
checkGrouping(searcher, "/?streaming.selection=true&query=onegroupinghit", 1);
}
use of com.yahoo.prelude.fastsearch.DocumentdbInfoConfig in project vespa by vespa-engine.
the class DocumentDatabaseTestCase method assertDocumentDBConfigAvailableForStreaming.
private void assertDocumentDBConfigAvailableForStreaming(String mode) {
final List<String> sds = Arrays.asList("type");
VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, mode), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
DocumentdbInfoConfig dcfg = model.getConfig(DocumentdbInfoConfig.class, "test/search/cluster.test.type");
assertEquals(1, dcfg.documentdb().size());
DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(0);
assertEquals("type", db.name());
}
use of com.yahoo.prelude.fastsearch.DocumentdbInfoConfig 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());
}
Aggregations