fix empty queries (#1783)

* fix empty queries

Mango text indexes currently throw function clauses when queries in two
situations:

1) Empty Selector
2) Operators with empty arrays.

We fix this issue and change the behavior as follows:

1) Any empty selector will fall back on _all_docs (like json indexes).
2) $or, $and, $in, $all that specify an empty arrays
will be treated as no-op when combined with other operators.
3) A single no-nop query such as {"$or": []} will not be executed and
return nothing just like json indexes.
4) $nin with an empty array will return all docs that match the field,
just like json indexes.

Co-authored-by: Jan Lehnardt <jan@apache.org>
Co-authored-by: Peng Hui Jiang <jiangphcn@apache.org>
11 files changed