You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2016/07/15 00:22:31 UTC
[1/2] couch-mrview commit: updated refs/heads/fix-unsorted-views to
22e0f92
Repository: couchdb-couch-mrview
Updated Branches:
refs/heads/fix-unsorted-views [created] 22e0f9273
Parse sorted param
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/734d1da7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/734d1da7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/734d1da7
Branch: refs/heads/fix-unsorted-views
Commit: 734d1da77cd6b4118f40bda4ded88daea91f1686
Parents: 6ec3597
Author: Russell Branca <ch...@apache.org>
Authored: Fri Jul 15 00:11:59 2016 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Fri Jul 15 00:11:59 2016 +0000
----------------------------------------------------------------------
src/couch_mrview_http.erl | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/734d1da7/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 9eb306b..3f29cac 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -518,6 +518,8 @@ parse_param(Key, Val, Args) ->
Args#mrargs{conflicts=parse_boolean(Val)};
"callback" ->
Args#mrargs{callback=couch_util:to_binary(Val)};
+ "sorted" ->
+ Args#mrargs{sorted=parse_boolean(Val)};
_ ->
BKey = couch_util:to_binary(Key),
BVal = couch_util:to_binary(Val),
[2/2] couch-mrview commit: updated refs/heads/fix-unsorted-views to
22e0f92
Posted by ch...@apache.org.
WIP: add support for sorted=false views
With sorted=false views, we get view rows prior to the meta row. So
let's just save the metadata until the end and tack on total_rows and
the other fields as we finish the response.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/22e0f927
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/22e0f927
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/22e0f927
Branch: refs/heads/fix-unsorted-views
Commit: 22e0f9273efaa00d5bbd4c0425ab688bbb125ca3
Parents: 734d1da
Author: Russell Branca <ch...@apache.org>
Authored: Fri Jul 15 00:12:45 2016 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Fri Jul 15 00:12:45 2016 +0000
----------------------------------------------------------------------
include/couch_mrview.hrl | 1 +
src/couch_mrview_http.erl | 8 ++++++++
2 files changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/22e0f927/include/couch_mrview.hrl
----------------------------------------------------------------------
diff --git a/include/couch_mrview.hrl b/include/couch_mrview.hrl
index 7dc7190..ed804b0 100644
--- a/include/couch_mrview.hrl
+++ b/include/couch_mrview.hrl
@@ -95,6 +95,7 @@
resp,
prepend,
etag,
+ meta,
should_close = false,
buffer = [],
bufsize = 0,
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/22e0f927/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 3f29cac..87022d9 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -339,6 +339,14 @@ view_cb({meta, Meta}, #vacc{resp=undefined}=Acc) ->
Headers = [],
{ok, Resp} = chttpd:start_delayed_json_response(Acc#vacc.req, 200, Headers),
view_cb({meta, Meta}, Acc#vacc{resp=Resp, should_close=true});
+view_cb({row, Row}, #vacc{resp=undefined}=Acc) ->
+ % sorted=false view start
+ Headers = [],
+ {ok, Resp} = chttpd:start_delayed_json_response(Acc#vacc.req, 200, Headers, "{\"rows\":[\r\n"),
+ view_cb({row, Row}, Acc#vacc{resp=Resp, should_close=true});
+view_cb({unsorted_meta, Meta}, #vacc{}=Acc) ->
+ %% TODO:: append total_rows upon view completion
+ {ok, Acc#vacc{meta=Meta}};
view_cb({meta, Meta}, #vacc{}=Acc) ->
% Sending metadata
Parts = case couch_util:get_value(total, Meta) of