MODE-2160 More indexing fixes and tests

Added several tests that use more kinds of indexes with additional queries. Several minor problems were identified and fixed.