

def do_filter_ranking(self, engine_slug, queryset, search_text):
    'Performs the full text ranking.'
    return queryset.extra(select={
        'watson_rank': "ts_rank_cd(watson_searchentry.search_tsv, to_tsquery('{search_config}', %s))".format(search_config=self.search_config),
    }, select_params=(self.escape_postgres_query(search_text),), order_by=('-watson_rank',))

dataset/ETHPy150Open etianen/django-watson/src/watson/backends.py PostgresSearchBackend.do_filter_ranking/original