davisp commented on a change in pull request #816: Fix mango json index 
selection
URL: https://github.com/apache/couchdb/pull/816#discussion_r139481287
 
 

 ##########
 File path: src/mango/src/mango_idx_view.erl
 ##########
 @@ -114,11 +114,11 @@ columns(Idx) ->
 
 
 is_usable(Idx, Selector) ->
-    % This index is usable if at least the first column is
-    % a member of the indexable fields of the selector.
-    Columns = columns(Idx),
-    Fields = indexable_fields(Selector),
-    lists:member(hd(Columns), Fields) andalso not is_text_search(Selector).
+    % This index is usable if all of the columns are 
+    % restricted by the selector such that they are required to exist
+    % and the selector is not a text search (so requires a text index)
+    RequiredFields = columns(Idx),
+    mango_selector:has_required_fields(Selector, RequiredFields) andalso not 
is_text_search(Selector).
 
 Review comment:
   Line too long. Break before andalso and indent it twice.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to