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.
Merge pull request #1223 from rhauch/mode-2160

MODE-2160 More indexing fixes and tests