getindices should not return truncated keys (redmine #2626)

I'm resubmitting this pull after adding an acceptance test.
The acceptance test will fail if a key is truncated by getindices().