Modify index generator to generate all prefixes

This now essentially builds a flattened trie-hash. This allows
constant-time lookup for any prefix. For example, if a teacher by the
name of "John Smith" is at index 3 in the original list, then all of the
following references will be arrays containing the value 3:

 * json_object['j']
 * json_object['jo']
 * json_object['joh']
 * json_object['john']
 * json_object['s']
 * json_object['sm']
 * json_object['smi']
 * json_object['smit']
 * json_object['smith']