willholley commented on a change in pull request #962: Mango: generate a
warning instead of an error when an user-specified index cannot be used
URL: https://github.com/apache/couchdb/pull/962#discussion_r153853203
##########
File path: src/mango/src/mango_cursor.erl
##########
@@ -150,12 +151,54 @@ group_indexes_by_type(Indexes) ->
end, ?CURSOR_MODULES).
-maybe_add_warning(UserFun, #idx{type = IndexType}, UserAcc) ->
- case IndexType of
+maybe_add_warning(UserFun, #cursor{index = Index, opts = Opts}, UserAcc) ->
+ UseIndexInvalid = case lists:keyfind(use_index, 1, Opts) of
+ {use_index, []} ->
+ [];
+ {use_index, [DesignId]} ->
+ case filter_indexes([Index], DesignId) of
+ [] ->
+ [fmt("_design/~s was not used because it does not contain
a valid index for this query.",
+ [ddoc_name(DesignId)])];
Review comment:
I figured the user can use _explain to see which index was used
----------------------------------------------------------------
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