diff options
author | John Christopher Anderson <jchris@apache.org> | 2009-05-10 09:12:01 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2009-05-10 09:12:01 +0000 |
commit | 2c8bc8ed6a2dc4ecdde08e779e4882f189485271 (patch) | |
tree | 98e826d28806b4fa96d273768719d78aa1355593 /src/couchdb/couch_httpd_db.erl | |
parent | d748a328aec166047c81bcaf3dec6b0a885a2088 (diff) |
Refactor the make_view_fold_function stuff. Added a proper Acc to both map and reduce view folds. Cleaned up some pattern matchers.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@773319 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_db.erl')
-rw-r--r-- | src/couchdb/couch_httpd_db.erl | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index b129d37e..f603def0 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -457,21 +457,21 @@ all_docs_view(Req, Db, Keys) -> true -> StartDocId end, FoldAccInit = {Limit, SkipCount, undefined, []}, - - PassedEndFun = - case Dir of - fwd -> - fun(ViewKey, _ViewId) -> - couch_db_updater:less_docid(EndKey, ViewKey) - end; - rev-> - fun(ViewKey, _ViewId) -> - couch_db_updater:less_docid(ViewKey, EndKey) - end - end, - + case Keys of nil -> + PassedEndFun = + case Dir of + fwd -> + fun(ViewKey, _ViewId) -> + couch_db_updater:less_docid(EndKey, ViewKey) + end; + rev-> + fun(ViewKey, _ViewId) -> + couch_db_updater:less_docid(ViewKey, EndKey) + end + end, + FoldlFun = couch_httpd_view:make_view_fold_fun(Req, QueryArgs, CurrentEtag, Db, TotalRowCount, #view_fold_helper_funs{ reduce_count = fun couch_db:enum_docs_reduce_to_count/1, |