'Performs reindex on index. Optimizes metadata and storage informations for given index.
You can\'t reindex **id** index.
:param index: the index to reindex
:type index: :py:class:`CodernityDB.index.Index`` instance, or string'

def reindex_index(self, index):

    if isinstance(index, basestring):
        if (not (index in self.indexes_names)):
            raise PreconditionsException(('No    index    named    %s' % index))
        index = self.indexes_names[index]
    elif (not (index in self.indexes)):
        self.__not_opened()
        raise PreconditionsException('Argument    must    be    Index    instance    or    valid    string    index    format')
    if (index.name == 'id'):
        self.__not_opened()
        raise PreconditionsException('Id    index    cannot    be    reindexed')
    if getattr(index, 'reindexing', False):
        raise ReindexException(('The    index=%s    is    still    reindexing' % index.name))
    all_iter = self.all('id')
    index.reindexing = True
    index.destroy()
    index.create_index()
    while True:
        try:
            curr = all_iter.next()
        except StopIteration:
            break
        else:
            self._single_reindex_index(index, curr)
    del index.reindexing
