From the Cloudant web ui I can execute the following query off my indexes :
<>/authoring-test/_design/surveys/_search/multiSearch?q=survey_type%3A%22template%22%20and%20visibility%3A%22public%22
But I am unable to access the same query using the java-cloudant api. My code is as follows :
Search search = db.search("_design/surveys/_search/multiSearch");
log.info("Retrieved search object");
surveys = search.limit(limit)
.includeDocs(false)
.query("survey_type:template", Survey.class);
but it throws a DocumentNotFound
exception.
Does anyone have any pointers on how to execute a query using the cloudant java api?
I found the solution :
Search search = db.search("search/multiSearch");
log.info("Retrieved search object");
surveys = search.limit(limit)
.includeDocs(true)
.query("survey_type:template", Survey.class);
Basically the error was a combination of includeDoc(false) and incorrect path to design document.
Hope this helps someone!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.