couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [5/5] couchdb-mango git commit: feedback
Date Wed, 27 Jan 2016 13:30:26 GMT
feedback


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mango/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mango/commit/854a0b5b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mango/tree/854a0b5b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mango/diff/854a0b5b

Branch: refs/heads/mango-catch-all
Commit: 854a0b5ba00ad96425b6171361735eba8b913881
Parents: e1497b0
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Wed Jan 27 14:30:08 2016 +0100
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Wed Jan 27 14:30:08 2016 +0100

----------------------------------------------------------------------
 src/mango_cursor.erl | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/854a0b5b/src/mango_cursor.erl
----------------------------------------------------------------------
diff --git a/src/mango_cursor.erl b/src/mango_cursor.erl
index a9967f3..4cccee1 100644
--- a/src/mango_cursor.erl
+++ b/src/mango_cursor.erl
@@ -31,32 +31,12 @@
 
 create(Db, Selector0, Opts) ->
     Selector = mango_selector:normalize(Selector0),
-    %UsableIndexes = mango_util:get_usable_indexes(Db, Selector0, Opts),
-
-    ExistingIndexes = mango_idx:list(Db),
-    if ExistingIndexes /= [] -> ok; true ->
-        ?MANGO_ERROR({no_usable_index, no_indexes_defined})
-    end,
-
-    FilteredIndexes = maybe_filter_indexes(ExistingIndexes, Opts),
-    if FilteredIndexes /= [] -> ok; true ->
-        ?MANGO_ERROR({no_usable_index, no_index_matching_name})
-    end,
-
-    SortIndexes = mango_idx:for_sort(FilteredIndexes, Opts),
-    if SortIndexes /= [] -> ok; true ->
-        ?MANGO_ERROR({no_usable_index, missing_sort_index})
-    end,
-
-    UsableFilter = fun(I) -> mango_idx:is_usable(I, Selector) end,
-    UsableIndexes = lists:filter(UsableFilter, SortIndexes),
+    UsableIndexes = mango_util:get_usable_indexes(Db, Selector0, Opts),
 
     {use_index, IndexSpecified} = proplists:lookup(use_index, Opts),
     case {length(UsableIndexes), length(IndexSpecified)} of
         {0, 1} ->
-            io:format("UsableIndexesAllDocs ~p~n", [{0, 1}]),
-
-            create_cursor(Db, UsableIndexes, Selector, Opts);
+            ?MANGO_ERROR({no_usable_index, selector_unsupported});
         {0, 0} ->
             AllDocs = mango_idx:special(Db),
             io:format("UsableIndexesAllDocs ~p~n", [{0, 0}]),


Mime
View raw message