X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/46a9e3561c9bf3641e9a2d2f4453f54da0abf310..d273a5bb2bdf640687ecb431be28e5abc21b80ca:/forum_modules/mysqlfulltext/startup.py?ds=sidebyside diff --git a/forum_modules/mysqlfulltext/startup.py b/forum_modules/mysqlfulltext/startup.py index e5d4849..8c2af5f 100644 --- a/forum_modules/mysqlfulltext/startup.py +++ b/forum_modules/mysqlfulltext/startup.py @@ -43,7 +43,7 @@ word_re = re.compile(r'\w+', re.UNICODE) def question_search(self, keywords): keywords = keywords.upper() - return '-ranking', self.filter( + qs = self.filter( models.Q(ftsindex__body__isnull=False) ).extra( select={ @@ -51,7 +51,8 @@ def question_search(self, keywords): match(forum_mysqlftsindex.tagnames) against (%s) * 2 + match(forum_mysqlftsindex.title) against (%s) * 4 + match(forum_mysqlftsindex.body) against (%s) * 1 - """, + """, }, select_params=[keywords, keywords, keywords] - ) + ).filter(Q(ftsindex__title__search=keywords) | Q(ftsindex__tagnames__search=keywords) | Q(ftsindex__body__search=keywords)) + return '-ranking', qs