summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_btree.erl3
-rw-r--r--src/couchdb/couch_httpd_view.erl3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/couchdb/couch_btree.erl b/src/couchdb/couch_btree.erl
index 30575090..29e82911 100644
--- a/src/couchdb/couch_btree.erl
+++ b/src/couchdb/couch_btree.erl
@@ -637,7 +637,8 @@ stream_kv_node(Bt, Reds, KVs, StartKey, Dir, Fun, Acc) ->
fun({Key, _}) -> less(Bt, StartKey, Key) end
end,
{LTKVs, GTEKVs} = lists:splitwith(DropFun, KVs),
- stream_kv_node2(Bt, Reds, LTKVs, GTEKVs, Dir, Fun, Acc).
+ AssembleLTKVs = [assemble(Bt,K,V) || {K,V} <- LTKVs],
+ stream_kv_node2(Bt, Reds, AssembleLTKVs, GTEKVs, Dir, Fun, Acc).
stream_kv_node2(_Bt, _Reds, _PrevKVs, [], _Dir, _Fun, Acc) ->
{ok, Acc};
diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl
index d281b82b..f01427a9 100644
--- a/src/couchdb/couch_httpd_view.erl
+++ b/src/couchdb/couch_httpd_view.erl
@@ -370,7 +370,6 @@ make_view_fold_fun(Req, QueryArgs, Db, TotalViewCount, ReduceCountFun) ->
fun({{Key, DocId}, Value}, OffsetReds,
{AccCount, AccSkip, Resp, AccRevRows}) ->
- Offset = ReduceCountFun(OffsetReds), % I think we only need this call once per view
PassedEnd = PassedEndFun(Key, DocId),
case {PassedEnd, AccCount, AccSkip, Resp} of
{true, _, _, _} ->
@@ -383,6 +382,8 @@ make_view_fold_fun(Req, QueryArgs, Db, TotalViewCount, ReduceCountFun) ->
{ok, {AccCount, AccSkip - 1, Resp, AccRevRows}};
{_, _, _, undefined} ->
{ok, Resp2} = start_json_response(Req, 200),
+ io:format("OffsetReds:~p~n", [OffsetReds]),
+ Offset = ReduceCountFun(OffsetReds),
JsonBegin = io_lib:format("{\"total_rows\":~w,\"offset\":~w,\"rows\":[\r\n",
[TotalViewCount, Offset]),
JsonObj = view_row_obj(Db, {{Key, DocId}, Value}, IncludeDocs),