From: jordan Date: Thu, 23 Jun 2011 16:05:55 +0000 (+0000) Subject: be sure to make the filtration of the queryset during search, the old search mechanis... X-Git-Tag: live~244 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/13f00004251eb9a3c6f62b5a176179a782319540 be sure to make the filtration of the queryset during search, the old search mechanism didn't exclude results with keywords that were not available git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1069 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum_modules/mysqlfulltext/startup.py b/forum_modules/mysqlfulltext/startup.py index e5d4849..1b12517 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={ @@ -54,4 +54,5 @@ def question_search(self, keywords): """, }, select_params=[keywords, keywords, keywords] - ) + ).filter(Q(title__search=keywords) | Q(tagnames__search=keywords) | Q(body__search=keywords)) + return '-ranking', qs