'Rebuild self.data and self.cache. Filter results are lost.'

def refresh(self, sort_field, ascending):

    FIELDS = {'title': 'sort', 'authors': 'author_sort', 'publisher': 'publisher', 'size': 'size', 'date': 'timestamp', 'timestamp': 'timestamp', 'formats': 'formats', 'rating': 'rating', 'tags': 'tags', 'series': 'series'}
    field = FIELDS[sort_field]
    order = 'ASC'
    if (not ascending):
        order = 'DESC'
    sort = ((field + '    ') + order)
    if (field == 'series'):
        sort += (',series_index    ' + order)
    elif (field == 'title'):
        sort += (',author_sort    ' + order)
    else:
        sort += (',title    ' + order)
    self.cache = self.conn.get(('SELECT    *    from    meta    ORDER    BY    ' + sort))
    self.data = self.cache
    self.conn.commit()
