]> git.openstreetmap.org Git - osqa.git/blobdiff - forum_modules/mysqlfulltext/startup.py
be sure to make the filtration of the queryset during search, the old search mechanis...
[osqa.git] / forum_modules / mysqlfulltext / startup.py
index 387019adb03dd66202ca651d1ffcb2e4e7dc80c6..1b12517bb688cdd8c6404c6639ccf0d311d0b617 100644 (file)
@@ -8,7 +8,7 @@ from forum.models.question import Question, QuestionManager
 from forum.models.node import Node
 from forum.modules import decorate
 
-VERSION = 3
+VERSION = 4
 
 f_name = None
 
@@ -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