- return False, self.filter(models.Q(ftsindex__body__search=keywords))
\ No newline at end of file
+ keywords = keywords.upper()
+
+ return '-ranking', self.filter(
+ models.Q(ftsindex__body__isnull=False)
+ ).extra(
+ select={
+ 'ranking': """
+ 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]
+ )