[WIP] add support for secondary indexes

We need to ensure that the tid makes it into the range index, as otherwise there will be no versioning for the index. So setting hasTid here is not correct.