Skip to content

Commit

Permalink
Bug 935414 - Limit number of constraint terms in filter query. r=lucasr
Browse files Browse the repository at this point in the history
  • Loading branch information
leibovic committed Nov 8, 2013
1 parent c9c1b5a commit 1941e08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mobile/android/base/db/LocalBrowserDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ private Cursor filterAllSites(ContentResolver cr, String[] projection, CharSeque
// the constraint string(s), treating space-separated words as separate constraints
if (!TextUtils.isEmpty(constraint)) {
String[] constraintWords = constraint.toString().split(" ");
for (int i = 0; i < constraintWords.length; i++) {
// Only create a filter query with a maximum of 10 constraint words
int constraintCount = Math.min(constraintWords.length, 10);
for (int i = 0; i < constraintCount; i++) {
selection = DBUtils.concatenateWhere(selection, "(" + Combined.URL + " LIKE ? OR " +
Combined.TITLE + " LIKE ?)");
String constraintWord = "%" + constraintWords[i] + "%";
Expand Down

0 comments on commit 1941e08

Please sign in to comment.