← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~lifeless/launchpad/bug-716774 into lp:launchpad

 

Robert Collins has proposed merging lp:~lifeless/launchpad/bug-716774 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #716774 in Launchpad itself: "Timeout on MaloneApplication:+bugs with fti and nearly all bug status"
  https://bugs.launchpad.net/launchpad/+bug/716774

For more details, see:
https://code.launchpad.net/~lifeless/launchpad/bug-716774/+merge/52966

Stop querying on BugTask.fti - it pessimises bug searches search a deprecated column and the targetname cache (which we need substring searching on anyway - we don't usefully find things in it with fti AFAICT)
-- 
https://code.launchpad.net/~lifeless/launchpad/bug-716774/+merge/52966
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/bug-716774 into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py	2011-03-09 23:10:10 +0000
+++ lib/lp/bugs/model/bugtask.py	2011-03-11 03:13:58 +0000
@@ -2260,8 +2260,7 @@
             # instead.
             params.orderby = [
                 SQLConstant("-rank(Bug.fti, ftq(%s))" % searchtext_quoted),
-                SQLConstant(
-                    "-rank(BugTask.fti, ftq(%s))" % searchtext_quoted)]
+                ]
 
         comment_clause = """BugTask.id IN (
             SELECT BugTask.id
@@ -2272,7 +2271,6 @@
                 AND MessageChunk.fti @@ ftq(%s))""" % searchtext_quoted
         text_search_clauses = [
             "Bug.fti @@ ftq(%s)" % searchtext_quoted,
-            "BugTask.fti @@ ftq(%s)" % searchtext_quoted,
             ]
         no_targetnamesearch = bool(features.getFeatureFlag(
             'malone.disable_targetnamesearch'))
@@ -2458,8 +2456,7 @@
             return DecoratedResultSet(resultset, result_decorator=decorator,
                 pre_iter_hook=pre_iter_hook)
 
-        bugtask_fti = SQL('BugTask.fti')
-        inner_resultrow = (BugTask, bugtask_fti)
+        inner_resultrow = (BugTask,)
         origin = self.buildOrigin(join_tables, [], clauseTables)
         resultset = store.using(*origin).find(inner_resultrow, query)
 

=== modified file 'lib/lp/bugs/tests/test_bugtask_search.py'
--- lib/lp/bugs/tests/test_bugtask_search.py	2011-03-03 05:18:26 +0000
+++ lib/lp/bugs/tests/test_bugtask_search.py	2011-03-11 03:13:58 +0000
@@ -265,12 +265,11 @@
         self.assertSearchFinds(params, self.bugtasks[:2])
 
     def setUpFullTextSearchTests(self):
-        # Set text fields indexed by Bug.fti, BugTask.fti or
+        # Set text fields indexed by Bug.fti, or
         # MessageChunk.fti to values we can search for.
         for bugtask, number in zip(self.bugtasks, ('one', 'two', 'three')):
             commenter = self.bugtasks[0].bug.owner
             with person_logged_in(commenter):
-                bugtask.statusexplanation = 'status explanation %s' % number
                 bugtask.bug.title = 'bug title %s' % number
                 bugtask.bug.newMessage(
                     owner=commenter, content='comment %s' % number)
@@ -281,10 +280,6 @@
         params = self.getBugTaskSearchParams(
             user=None, searchtext='one title')
         self.assertSearchFinds(params, self.bugtasks[:1])
-        # ... by BugTask.fti ...
-        params = self.getBugTaskSearchParams(
-            user=None, searchtext='two explanation')
-        self.assertSearchFinds(params, self.bugtasks[1:2])
         # ...and by MessageChunk.fti
         params = self.getBugTaskSearchParams(
             user=None, searchtext='three comment')
@@ -296,10 +291,6 @@
         params = self.getBugTaskSearchParams(
             user=None, fast_searchtext='one title')
         self.assertSearchFinds(params, self.bugtasks[:1])
-        # ... but not text indexed by BugTask.fti ...
-        params = self.getBugTaskSearchParams(
-            user=None, fast_searchtext='two explanation')
-        self.assertSearchFinds(params, [])
         # ..or by MessageChunk.fti
         params = self.getBugTaskSearchParams(
             user=None, fast_searchtext='three comment')