зеркало из https://github.com/mozilla/gecko-dev.git
Bug 738961 - Awesomebar filter should treat space-separated words as separate filters. r=lucasr
This commit is contained in:
Родитель
54d92153d5
Коммит
3641813e9b
|
@ -143,13 +143,19 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||||
|
|
||||||
private Cursor filterAllSites(ContentResolver cr, String[] projection, CharSequence constraint,
|
private Cursor filterAllSites(ContentResolver cr, String[] projection, CharSequence constraint,
|
||||||
int limit, CharSequence urlFilter) {
|
int limit, CharSequence urlFilter) {
|
||||||
// The combined history/bookmarks selection queries for sites with a url or title
|
String selection = "";
|
||||||
// containing the constraint string
|
String[] selectionArgs = null;
|
||||||
String selection = "(" + Combined.URL + " LIKE ? OR " +
|
|
||||||
Combined.TITLE + " LIKE ?)";
|
|
||||||
|
|
||||||
final String historySelectionArg = "%" + constraint.toString() + "%";
|
// The combined history/bookmarks selection queries for sites with a url or title containing
|
||||||
String[] selectionArgs = new String[] { historySelectionArg, historySelectionArg };
|
// 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) {
|
if (urlFilter != null) {
|
||||||
selection = DBUtils.concatenateWhere(selection, "(" + Combined.URL + " NOT LIKE ?)");
|
selection = DBUtils.concatenateWhere(selection, "(" + Combined.URL + " NOT LIKE ?)");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче