mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 738961 - Awesomebar filter should treat space-separated words as separate filters. r=lucasr
This commit is contained in:
parent
54d92153d5
commit
3641813e9b
@ -143,13 +143,19 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
|
||||
private Cursor filterAllSites(ContentResolver cr, String[] projection, CharSequence constraint,
|
||||
int limit, CharSequence urlFilter) {
|
||||
// The combined history/bookmarks selection queries for sites with a url or title
|
||||
// containing the constraint string
|
||||
String selection = "(" + Combined.URL + " LIKE ? OR " +
|
||||
Combined.TITLE + " LIKE ?)";
|
||||
String selection = "";
|
||||
String[] selectionArgs = null;
|
||||
|
||||
final String historySelectionArg = "%" + constraint.toString() + "%";
|
||||
String[] selectionArgs = new String[] { historySelectionArg, historySelectionArg };
|
||||
// The combined history/bookmarks selection queries for sites with a url or title containing
|
||||
// the constraint string(s), treating space-separated words as separate constraints
|
||||
String[] constraintWords = constraint.toString().split(" ");
|
||||
for (int i = 0; i < constraintWords.length; i++) {
|
||||
selection = DBUtils.concatenateWhere(selection, "(" + Combined.URL + " LIKE ? OR " +
|
||||
Combined.TITLE + " LIKE ?)");
|
||||
String constraintWord = "%" + constraintWords[i] + "%";
|
||||
selectionArgs = DBUtils.appendSelectionArgs(selectionArgs,
|
||||
new String[] { constraintWord, constraintWord });
|
||||
}
|
||||
|
||||
if (urlFilter != null) {
|
||||
selection = DBUtils.concatenateWhere(selection, "(" + Combined.URL + " NOT LIKE ?)");
|
||||
|
Loading…
Reference in New Issue
Block a user