Details
Description
I'm using the Java 1.1-dp client to do queries against views. Setting query.setIncludeDocs(true) doesn't actually result in the query ViewResponse having documents (ViewRow.getDocument() returns null).
Digging into the code, it looks like that the Query class doesn't actually set the "include_docs" parameter, nor does DocsOperationImpl.parseResult try to extract the "doc" element from the returned JSON.
Is this deliberate? Or am I missing something? I'd really prefer not having to make a separate call to get the docs while iterating through a ViewResponse.
Digging into the code, it looks like that the Query class doesn't actually set the "include_docs" parameter, nor does DocsOperationImpl.parseResult try to extract the "doc" element from the returned JSON.
Is this deliberate? Or am I missing something? I'd really prefer not having to make a separate call to get the docs while iterating through a ViewResponse.
JCBC-102If I use CouchbaseConnectionFactory instead ViewRow.getDocument() returns the document correctly.
i.e:
URI base = new URI(String.format("http://%s:8091/pools", server));
List<URI> baseURIs = new ArrayList<URI>();
baseURIs.add(base);
CouchbaseConnectionFactoryBuilder cfb = new CouchbaseConnectionFactoryBuilder();
cfb.setOpTimeout(10000);
cfb.setOpQueueMaxBlockTime(10000);
CouchbaseConnectionFactory cf = cfb.buildCouchbaseConnection(baseURIs, bucket, "", "");
CouchbaseClient client = new CouchbaseClient(cf);
//...
View view = client.getView(myDesignDoc, myView);
Query query = new Query();
query.setRange(start, end);
query.setIncludeDocs(true);
ViewResponse viewResponse = client.query(view, query);
for(ViewRow viewRow:viewResponse){
String id = viewRow.getId(); // id ok
String key = viewRow.getKey(); // key ok
String value = viewRow.getValue(); // value ok
String doc = (String) viewRow.getDocument(); // doc is null
}
VERSUS:
URI base = new URI(String.format("http://%s:8091/pools", server));
List<URI> baseURIs = new ArrayList<URI>();
baseURIs.add(base);
CouchbaseConnectionFactory cf = new CouchbaseConnectionFactory(baseURIs, bucket, "");
CouchbaseClient client = new CouchbaseClient(cf);
//...
View view = client.getView(myDesignDoc, myView);
Query query = new Query();
query.setRange(start, end);
query.setIncludeDocs(true);
ViewResponse viewResponse = client.query(view, query);
for(ViewRow viewRow:viewResponse){
String id = viewRow.getId(); // id ok
String key = viewRow.getKey(); // key ok
String value = viewRow.getValue(); // value ok
String doc = (String) viewRow.getDocument(); // doc ok
}