You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2016/07/21 21:56:30 UTC

chttpd commit: updated refs/heads/couchdb-3070-fix-multi-query-view-type to 12af169

Repository: couchdb-chttpd
Updated Branches:
  refs/heads/couchdb-3070-fix-multi-query-view-type [created] 12af1697b


In a view multi-query request, set view type for each query

View type can be overridden if user explicitly sets reduce=false, for example.
This can happen for individual query.

Previously this didn't happen and view_type was set once at the top,  just
based on the view itself. For for example, a query like this:

```
{
  "queries": [{
    "include_docs": true,
    "reduce": false
  }]
}
```

would fail with:

```
{"error":"query_parse_error","reason":"`include_docs` is invalid for reduce"}
```

But it shouldn't fail because user explicitly disabled `reduce` for that one.

To fix, make sure to call `set_view_type` for each query's args.

Jira: COUCHDB-3070


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/12af1697
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/12af1697
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/12af1697

Branch: refs/heads/couchdb-3070-fix-multi-query-view-type
Commit: 12af1697bcc40e40eec1aef1b96c0afb85cce2bd
Parents: 21be898
Author: Nick Vatamaniuc <va...@gmail.com>
Authored: Thu Jul 21 17:48:15 2016 -0400
Committer: Nick Vatamaniuc <va...@gmail.com>
Committed: Thu Jul 21 17:48:15 2016 -0400

----------------------------------------------------------------------
 src/chttpd_view.erl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/12af1697/src/chttpd_view.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_view.erl b/src/chttpd_view.erl
index 4889b65..9bd480c 100644
--- a/src/chttpd_view.erl
+++ b/src/chttpd_view.erl
@@ -23,7 +23,8 @@ multi_query_view(Req, Db, DDoc, ViewName, Queries) ->
     ArgQueries = lists:map(fun({Query}) ->
         QueryArg = couch_mrview_http:parse_params(Query, undefined,
             Args1, [decoded]),
-        couch_mrview_util:validate_args(QueryArg)
+        QueryArg1 = couch_mrview_util:set_view_type(QueryArg, ViewName, Views),
+        couch_mrview_util:validate_args(QueryArg1)
     end, Queries),
     VAcc0 = #vacc{db=Db, req=Req, prepend="\r\n"},
     FirstChunk = "{\"results\":[",