X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/a96146751bc832353122e91895ea90512e266e4a..2591b1770a0d108069a8b1ffee485ae02f796263:/forum_modules/pgfulltext/handlers.py diff --git a/forum_modules/pgfulltext/handlers.py b/forum_modules/pgfulltext/handlers.py index 835c2f5..2b57e96 100644 --- a/forum_modules/pgfulltext/handlers.py +++ b/forum_modules/pgfulltext/handlers.py @@ -5,10 +5,11 @@ from forum.views.readers import do_question_search @decorate(do_question_search, needs_origin=False) def question_search(keywords): return Question.objects.all().extra( + tables=['forum_rootnode_doc'], select={ - 'ranking': 'node_ranking("forum_node"."id", %s)', + 'ranking': 'ts_rank_cd("forum_rootnode_doc"."document", plainto_tsquery(\'english\', %s), 32)', }, - where=['node_ranking("forum_node"."id", %s) > 0'], + where=['"forum_rootnode_doc"."node_id" = "forum_node"."id"', '"forum_rootnode_doc"."document" @@ plainto_tsquery(\'english\', %s)'], params=[keywords], select_params=[keywords], order_by=['-ranking']