willholley closed pull request #1025: Fix _explain for sort descending
URL: https://github.com/apache/couchdb/pull/1025
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/mango/src/mango_cursor_view.erl
b/src/mango/src/mango_cursor_view.erl
index 3fcec07be9..7c57b14142 100644
--- a/src/mango/src/mango_cursor_view.erl
+++ b/src/mango/src/mango_cursor_view.erl
@@ -66,7 +66,7 @@ explain(Cursor) ->
{include_docs, Args#mrargs.include_docs},
{view_type, Args#mrargs.view_type},
{reduce, Args#mrargs.reduce},
- {start_key, Args#mrargs.start_key},
+ {start_key, maybe_replace_max_json(Args#mrargs.start_key)},
{end_key, maybe_replace_max_json(Args#mrargs.end_key)},
{direction, Args#mrargs.direction},
{stable, Args#mrargs.stable},
diff --git a/src/mango/test/05-index-selection-test.py
b/src/mango/test/05-index-selection-test.py
index f8cc825768..ef662a918b 100644
--- a/src/mango/test/05-index-selection-test.py
+++ b/src/mango/test/05-index-selection-test.py
@@ -181,6 +181,14 @@ def test_manual_bad_view_idx01(self):
self.db.save_doc(design_doc)
+ def test_explain_sort_reverse(self):
+ selector = {
+ "manager": {"$gt": None}
+ }
+ resp_explain = self.db.find(selector, fields=["manager"],
sort=[{"manager":"desc"}], explain=True)
+ self.assertEqual(resp_explain["index"]["type"], "json")
+
+
class JSONIndexSelectionTests(mango.UserDocsTests, IndexSelectionTests):
@classmethod
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services