def _prepare_results(self, results):
        """
        Sort results by score if not done before (faster, if we have no values to
        retrieve, or slice)
        """
        # if we want a result sorted by a score, and if we have a full result
        # (no slice), we can do it know, by creating keys for each values with
        # the sorted set score, and sort on them
        if self._sort_by_sortedset_after and (len(results) > 1 or self._values):
            conn = self.cls.get_connection()

            sort_params = {}
            base_tmp_key, tmp_keys = self._prepare_sort_by_score(results, sort_params)

            # compose the set to sort
            final_set = '%s_final_set' % base_tmp_key
            conn.sadd(final_set, *results)

            # apply the sort
            results = conn.sort(final_set, **sort_params)

            # finally delete all temporary keys
            conn.delete(*(tmp_keys + [final_set, base_tmp_key]))

        if self._store:
            # if store, redis doesn't return result, so don't return anything here
            return

        if self._values and self._values['mode'] != 'flat':
            results = self._to_values(results)

        return super(ExtendedCollectionManager, self)._prepare_results(results)
def _prepare_results ( self , results ) : if self . _sort_by_sortedset_after and ( len ( results ) > 1 or self . _values ) : conn = self . cls . get_connection ( ) sort_params = { } base_tmp_key , tmp_keys = self . _prepare_sort_by_score ( results , sort_params ) final_set = '%s_final_set' % base_tmp_key conn . sadd ( final_set , * results ) results = conn . sort ( final_set , ** sort_params ) conn . delete ( * ( tmp_keys + [ final_set , base_tmp_key ] ) ) if self . _store : return if self . _values and self . _values [ 'mode' ] != 'flat' : results = self . _to_values ( results ) return super ( ExtendedCollectionManager , self ) . _prepare_results ( results )
Sort results by score if not done before (faster, if we have no values to
        retrieve, or slice)