couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject chttpd commit: updated refs/heads/couchdb-3070-fix-multi-query-view-type to 12af169
Date Thu, 21 Jul 2016 21:56:30 GMT
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 <vatamane@gmail.com>
Authored: Thu Jul 21 17:48:15 2016 -0400
Committer: Nick Vatamaniuc <vatamane@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\":[",


Mime
View raw message