add index querying and tests

this commit includes code for (the very verbosely named):

- indexLessThanIndex
- indexLessThanOrEqualToIndex
- indexGreaterThanIndex
- indexGreaterThanOrEqualToIndex