Use short circuit operators COUCHDB-2787
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mango/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mango/commit/8b6d0dbd Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mango/tree/8b6d0dbd Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mango/diff/8b6d0dbd Branch: refs/heads/master Commit: 8b6d0dbd3540cf34d9703526ba0b0b6d3226ff8d Parents: 928d76a Author: Tony Sun <tony....@cloudant.com> Authored: Thu Sep 3 15:26:59 2015 -0700 Committer: Tony Sun <tony....@cloudant.com> Committed: Thu Sep 3 15:26:59 2015 -0700 ---------------------------------------------------------------------- src/mango_idx_view.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/8b6d0dbd/src/mango_idx_view.erl ---------------------------------------------------------------------- diff --git a/src/mango_idx_view.erl b/src/mango_idx_view.erl index a313f56..cc5bcb3 100644 --- a/src/mango_idx_view.erl +++ b/src/mango_idx_view.erl @@ -112,7 +112,7 @@ is_usable(Idx, Selector) -> % a member of the indexable fields of the selector. Columns = columns(Idx), Fields = indexable_fields(Selector), - lists:member(hd(Columns), Fields) and not is_text_search(Selector). + lists:member(hd(Columns), Fields) andalso not is_text_search(Selector). is_text_search({[]}) -> @@ -121,7 +121,7 @@ is_text_search({[{<<"$default">>, _}]}) -> true; is_text_search({[{_Field, Cond}]}) when is_list(Cond) -> lists:foldl(fun(C, Exists) -> - Exists or is_text_search(C) + Exists orelse is_text_search(C) end, false, Cond); is_text_search({[{_Field, Cond}]}) when is_tuple(Cond) -> is_text_search(Cond);