1 from forum.models import Question
2 from forum.modules.decorators import decorate
3 from forum.views.readers import do_question_search
5 @decorate(do_question_search, needs_origin=False)
6 def question_search(keywords):
7 return Question.objects.all().extra(
8 tables=['forum_rootnode_doc'],
10 'ranking': 'ts_rank_cd("forum_rootnode_doc"."document", plainto_tsquery(\'english\', %s), 32)',
12 where=['"forum_rootnode_doc"."node_id" = "forum_node"."id"', '"forum_rootnode_doc"."document" @@ plainto_tsquery(\'english\', %s)'],
14 select_params=[keywords],