def set_index(self, index_name, index):
if not index_name:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if index_name in self.indexes:<EOL><INDENT>raise ValueError("<STR_LIT>".format(<EOL>index_name, str(self.indexes[index_name].fields)<EOL>))<EOL><DEDENT>if not isinstance(index, Index): raise ValueError("<STR_LIT>".format(type(index)))<EOL>index.name = index_name<EOL>self.indexes[index_name] = index<EOL>return self<EOL>
add an index to the schema

for the most part, you will use the __getattr__ method of adding indexes for a more fluid interface,
but you can use this if you want to get closer to the bare metal

index_name -- string -- the name of the index
index -- Index() -- an Index instance