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 2019/08/29 20:23:58 UTC

[couchdb] branch prototype/fdb-layer-fix-docid-keys-for-all-docs created (now 923448c)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch prototype/fdb-layer-fix-docid-keys-for-all-docs
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 923448c  Handle startkey_docid and endkey_docid for _all_docs

This branch includes the following new commits:

     new 923448c  Handle startkey_docid and endkey_docid for _all_docs

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Handle startkey_docid and endkey_docid for _all_docs

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch prototype/fdb-layer-fix-docid-keys-for-all-docs
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 923448c6f5ee27c7ac5cab0d48ecdd2782885d36
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Thu Aug 29 16:22:49 2019 -0400

    Handle startkey_docid and endkey_docid for _all_docs
---
 src/chttpd/src/chttpd_db.erl | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index dbb92fa..769aa1f 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -838,15 +838,7 @@ all_docs_view(Req, Db, Keys, OP) ->
     },
     case Args1#mrargs.keys of
         undefined ->
-            Options = [
-                {user_ctx, Req#httpd.user_ctx},
-                {dir, Args1#mrargs.direction},
-                {start_key, Args1#mrargs.start_key},
-                {end_key, Args1#mrargs.end_key},
-                {limit, Args1#mrargs.limit},
-                {skip, Args1#mrargs.skip},
-                {update_seq, Args1#mrargs.update_seq}
-            ],
+            Options = all_docs_view_opts(Args1, Req),
             Acc = {iter, Db, Args1, VAcc0},
             {ok, {iter, _, _, Resp}} =
                     fabric2_db:fold_docs(Db, fun view_cb/2, Acc, Options),
@@ -919,6 +911,26 @@ all_docs_view(Req, Db, Keys, OP) ->
     end.
 
 
+all_docs_view_opts(Args, Req) ->
+    StartKey = case Args#mrargs.start_key of
+        undefined -> Args#mrargs.start_key_docid;
+        SKey -> SKey
+    end,
+    EndKey = case Args#mrargs.end_key of
+        undefined -> Args#mrargs.end_key_docid;
+        EKey -> EKey
+    end,
+    [
+        {user_ctx, Req#httpd.user_ctx},
+        {dir, Args#mrargs.direction},
+        {start_key, StartKey},
+        {end_key, EndKey},
+        {limit, Args#mrargs.limit},
+        {skip, Args#mrargs.skip},
+        {update_seq, Args#mrargs.update_seq}
+    ].
+
+
 apply_args_to_keylist(Args, Keys0) ->
     Keys1 = case Args#mrargs.direction of
         fwd -> Keys0;