[WIP] add support for secondary indexes

It would be nice to move this out to its own function.