helun/Ektorp

querying a doc with a show function

eroux opened this issue · 1 comments

eroux commented

I have the following design document:

{
  "_id": "_design/jsonld",
  "_rev": "6-1d31766f96fe194d286cc9cf8c31e5c6",
  "shows": {
    "jsonld": "function(doc, req) {\n  return toJSON(doc[\"@graph\"]);\n}"
  },
  "language": "javascript"
}

and would like to query documents according to this view. It seems impossible with the current API.

You're right, there is no explicit way to query a show function.

You may be able to do it by either :

  • extending the ViewQuery class in order to override org.ektorp.ViewQuery#buildQueryURI so that is generated the appropriate URI : "_show" instead of "_view" then pass it to org.ektorp.CouchDbConnector#queryForStream
  • directly use a org.ektorp.http.RestTemplate instance with the appropriate URI
  • change Ektorp to allow explicit support for show queries, then propose a pull request