MODE-2290 Corrected use of indexes for criteria with aliases and bind variables

Corrected the way that indexes are planned for criteria that involve aliases and bind variables. Also added several new tests to verify the expected behavior.