Anonymous avatar Anonymous committed bd253fb

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

Comments (0)

Files changed (1)

         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] + '%')
             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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.