'Performs update operation on single index
:param index: the index to perform operation
:param data: new data
:param db_data: database data
:param doc_id: the id of document'

def _single_update_index(self, index, data, db_data, doc_id):

    try:
        old_should_index = index.make_key_value(db_data)
    except Exception as ex:
        warnings.warn(('Problem    during    update    for    `%s`,    ex    =    `%s`,    uou    should    check    index    code.' % (index.name, ex)), RuntimeWarning)
        old_should_index = None
    if old_should_index:
        (old_key, old_value) = old_should_index
        try:
            new_should_index = index.make_key_value(data)
        except Exception as ex:
            warnings.warn(('Problem    during    update    for    `%s`,    ex    =    `%r`,    you    should    check    index    code.' % (index.name, ex)), RuntimeWarning)
            new_should_index = None
        if new_should_index:
            (new_key, new_value) = new_should_index
            if (new_key != old_key):
                index.delete(doc_id, old_key)
                index.insert_with_storage(doc_id, new_key, new_value)
            elif (new_value != old_value):
                try:
                    index.update_with_storage(doc_id, new_key, new_value)
                except (ElemNotFound, DocIdNotFound):
                    warnings.warn(('Reindex    might    be    required    for    index    %s' % index.name))
        else:
            index.delete(doc_id, old_key)
    else:
        self._single_insert_index(index, data, doc_id)
