davisp commented on a change in pull request #816: Fix mango json index
selection
URL: https://github.com/apache/couchdb/pull/816#discussion_r139481549
##########
File path: src/mango/src/mango_selector.erl
##########
@@ -566,3 +567,111 @@ match({[{Field, Cond}]}, Value, Cmp) ->
match({[_, _ | _] = _Props} = Sel, _Value, _Cmp) ->
erlang:error({unnormalized_selector, Sel}).
+
+
+
+% Returns true if Selector requires all
+% fields in RequiredFields to exist in any matching documents.
+
+% For each condition in the selector, check
+% whether the field is in RequiredFields.
+% If it is, remove it from RequiredFields and continue
+% until we match then all or run out of selector to
+% match against.
+
+% empty selector
+has_required_fields({[]}, _) ->
+ false;
+
+has_required_fields(Selector, RequiredFields) when not is_list(Selector) ->
+ has_required_fields([Selector], RequiredFields);
+
+% "see" through $and operator. We ignore other
Review comment:
The first sentence isn't a sentence. "We can" as a prefix would be good
enough.
----------------------------------------------------------------
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