0
votes

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?

1
improved formatting a tiny bit - Ori Lentz

1 Answers

0
votes

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!