Bug 716089 - Fix query syntax for filtering URLs on local DB (r=blassey, a=akeybl)
authorLucas Rocha <lucasr@mozilla.com>
Mon, 16 Jan 2012 14:13:40 +0000
changeset 84909 8a36f0202bd7d08e080907f0ec3b2bc5d9f1cb1b
parent 84908 e78e431b2354f897e83af7d3bf3c4b4e0323d293
child 84910 15bbd03602a46223d1d0b43232216519dfc8f7ce
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, akeybl
bugs716089
milestone11.0a2
Bug 716089 - Fix query syntax for filtering URLs on local DB (r=blassey, a=akeybl)
mobile/android/base/db/LocalBrowserDB.java
--- a/mobile/android/base/db/LocalBrowserDB.java
+++ b/mobile/android/base/db/LocalBrowserDB.java
@@ -83,17 +83,17 @@ public class LocalBrowserDB implements B
 
     public Cursor filter(ContentResolver cr, CharSequence constraint, int limit, CharSequence urlFilter) {
         Cursor c = cr.query(appendProfileAndLimit(History.CONTENT_URI, limit),
                             new String[] { History._ID,
                                            History.URL,
                                            History.TITLE,
                                            History.FAVICON,
                                            History.THUMBNAIL },
-                            (urlFilter != null ? "(" + History.URL + " NOT LIKE ? )" : "" )+ 
+                            (urlFilter != null ? "(" + History.URL + " NOT LIKE ? ) AND " : "" ) + 
                             "(" + History.URL + " LIKE ? OR " + History.TITLE + " LIKE ?)",
                             urlFilter == null ? new String[] {"%" + constraint.toString() + "%", "%" + constraint.toString() + "%"} :
                             new String[] {urlFilter.toString(), "%" + constraint.toString() + "%", "%" + constraint.toString() + "%"},
                             // ORDER BY is number of visits times a multiplier from 1 - 120 of how recently the site
                             // was accessed with a site accessed today getting 120 and a site accessed 119 or more
                             // days ago getting 1
                             History.VISITS + " * MAX(1, (" +
                             History.DATE_LAST_VISITED + " - " + new Date().getTime() + ") / 86400000 + 120) DESC");