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 2023/02/14 15:14:43 UTC
[couchdb] 02/05: mango: Remove unused parameter from the JSON index selection
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit b08dc7ac77dd3ea53cf1b8b92571387478e5b143
Author: Gabor Pali <ga...@ibm.com>
AuthorDate: Mon Feb 13 22:52:26 2023 +0100
mango: Remove unused parameter from the JSON index selection
---
src/mango/src/mango_cursor_special.erl | 2 +-
src/mango/src/mango_cursor_view.erl | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/mango/src/mango_cursor_special.erl b/src/mango/src/mango_cursor_special.erl
index 59eb2baad..8ea7e914b 100644
--- a/src/mango/src/mango_cursor_special.erl
+++ b/src/mango/src/mango_cursor_special.erl
@@ -32,7 +32,7 @@ create(Db, Indexes, Selector, Opts) ->
% catchall is the most expensive range
FieldRanges = InitialRange ++ CatchAll,
Composited = mango_cursor_view:composite_indexes(Indexes, FieldRanges),
- {Index, IndexRanges} = mango_cursor_view:choose_best_index(Db, Composited),
+ {Index, IndexRanges} = mango_cursor_view:choose_best_index(Composited),
Limit = couch_util:get_value(limit, Opts, mango_opts:default_limit()),
Skip = couch_util:get_value(skip, Opts, 0),
diff --git a/src/mango/src/mango_cursor_view.erl b/src/mango/src/mango_cursor_view.erl
index 47195341c..3f67f667b 100644
--- a/src/mango/src/mango_cursor_view.erl
+++ b/src/mango/src/mango_cursor_view.erl
@@ -23,7 +23,7 @@
handle_message/2,
handle_all_docs_message/2,
composite_indexes/2,
- choose_best_index/2
+ choose_best_index/1
]).
-include_lib("couch/include/couch_db.hrl").
@@ -51,7 +51,7 @@ viewcbargs_get(fields, Args) when is_map(Args) ->
create(Db, Indexes, Selector, Opts) ->
FieldRanges = mango_idx_view:field_ranges(Selector),
Composited = composite_indexes(Indexes, FieldRanges),
- {Index, IndexRanges} = choose_best_index(Db, Composited),
+ {Index, IndexRanges} = choose_best_index(Composited),
Limit = couch_util:get_value(limit, Opts, mango_opts:default_limit()),
Skip = couch_util:get_value(skip, Opts, 0),
@@ -230,7 +230,7 @@ composite_prefix([Col | Rest], Ranges) ->
% In the future we can look into doing a cached parallel
% reduce view read on each index with the ranges to find
% the one that has the fewest number of rows or something.
-choose_best_index(_DbName, IndexRanges) ->
+choose_best_index(IndexRanges) ->
Cmp = fun({IdxA, _PrefixA, PrefixDifferenceA}, {IdxB, _PrefixB, PrefixDifferenceB}) ->
case PrefixDifferenceA - PrefixDifferenceB of
N when N < 0 -> true;