You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/01/26 15:19:58 UTC

[GitHub] davisp commented on a change in pull request #1110: Make _design_docs to respect query parameters

davisp commented on a change in pull request #1110: Make _design_docs to respect query parameters
URL: https://github.com/apache/couchdb/pull/1110#discussion_r164137459
 
 

 ##########
 File path: src/couch/src/couch_db.erl
 ##########
 @@ -1738,14 +1738,26 @@ do_pipe([Filter|Rest], F0) ->
 
 set_namespace_range(Options, undefined) -> Options;
 set_namespace_range(Options, NS) ->
-    %% FIXME depending on order we might need to swap keys
-    SK = select_gt(
-           proplists:get_value(start_key, Options, <<"">>),
-           <<NS/binary, "/">>),
-    EK = select_lt(
-           proplists:get_value(end_key, Options, <<NS/binary, "0">>),
-           <<NS/binary, "0">>),
-    [{start_key, SK}, {end_key_gt, EK}].
+    SK0 = proplists:get_value(start_key, Options, <<NS/binary, "/">>),
+    EKType = case proplists:get_value(end_key_gt, Options) of
+        undefined -> end_key;
+        _ -> end_key_gt
+    end,
+    EK0 = case EKType of
+        end_key -> proplists:get_value(end_key, Options, <<NS/binary, "0">>);
+        end_key_gt ->
+            proplists:get_value(end_key_gt, Options, <<NS/binary, "0">>)
+    end,
+    case SK0 =< EK0 of
 
 Review comment:
   We should pass the dir option in Options rather than detecting it here as this behavior of looking at the keys to define the order doesn't match _all_docs which was the stated intention.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services