2017-04-16 55 views

回答

5

使用StructuredQueryBuilderand()collection()方法來構造等價結構化查詢搜索在這兩個集合中的文檔。

// create the client -- this will change slightly in Java Client API 4.x 
DatabaseClient client = 
    DatabaseClientFactory.newClient(host, port, user, password, authType); 
// create a manager for searching 
QueryManager queryMgr = client.newQueryManager(); 

// create a query builder 
StructuredQueryBuilder qb = new StructuredQueryBuilder(); 
// build a search definition 
StructuredQueryDefinition query = 
    qb.and(
     qb.collection("/abc/xyz"), 
     qb.collection("/abc/xyz/pqr")); 

// run the search 
queryMgr.search(query, resultsHandle);