1. Alex Willmer
  2. trac-ticketlinks

Commits

cmlenz  committed bd253fb

0.8-stable: fix search broken in 0.8.1-3sarge3, due to missing substring matching.

  • Participants
  • Parent commits 2946e56
  • Branches 0.8-stable

Comments (0)

Files changed (1)

File trac/Search.py

View file
         self.log.debug("Query: %s" % q)
         if q[0] == q[-1] == "'" or q[0] == q[-1] == '"':
             sql_q = "%s LIKE %%s" % name
-            params.append(q[1:-1])
+            params.append('%' + q[1:-1] + '%')
         else:
             keywords = q.split(' ')
             x = map(lambda x, name=name: name + ' LIKE %s', keywords)
             sql_q = string.join(x, ' AND ')
-            params += keywords
+            params += [('%' + kw + '%') for kw in keywords]
         self.log.debug("SQL Condition: %s" % sql_q)
         return sql_q
     
         q_str += ' ORDER BY 7 DESC LIMIT %d OFFSET %d' % \
                  (self.RESULTS_PER_PAGE + 1, self.RESULTS_PER_PAGE * page)
 
-        self.log.debug("SQL Query: %s" % q_str)
+        self.log.debug("SQL Query: %s, %s" % (q_str, repr(params)))
         cursor.execute(q_str, params)
 
         # Make the data more HDF-friendly