diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2009-09-29 10:17:01 -0700 |
---|---|---|
committer | Dmitri Plotnikov <dplotnikov@google.com> | 2009-09-29 10:19:36 -0700 |
commit | bae94ada3546ed32182f50303a733752d5ef7178 (patch) | |
tree | 1a423ddce5612c057a6c8bf76eef47d5bb319fea /src | |
parent | 6a809c1d28c1ba36203d9e54709a08667478d9d7 (diff) | |
download | ContactsProvider-bae94ada3546ed32182f50303a733752d5ef7178.tar.gz |
[Issue 2153617] Increasing contact aggregation suggestion cap and constraining lookup types.
Change-Id: I27664191830865e300ba3f943f1067c8e48c4be7
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/providers/contacts/ContactAggregator.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/com/android/providers/contacts/ContactAggregator.java b/src/com/android/providers/contacts/ContactAggregator.java index 7d124e98..2fa8d116 100644 --- a/src/com/android/providers/contacts/ContactAggregator.java +++ b/src/com/android/providers/contacts/ContactAggregator.java @@ -161,6 +161,9 @@ public class ContactAggregator implements ContactAggregationScheduler.Aggregator // don't attempt to aggregate - this is likely an error or a shared corporate data element. private static final int SECONDARY_HIT_LIMIT = 20; + // If we encounter more than this many contacts with matching name during aggregation + // suggestion lookup, ignore the remaining results. + private static final int FIRST_LETTER_SUGGESTION_HIT_LIMIT = 100; private final ContactsProvider2 mContactsProvider; private final OpenHelper mOpenHelper; @@ -1004,7 +1007,7 @@ public class ContactAggregator implements ContactAggregationScheduler.Aggregator selection.append(")"); matchAllCandidates(db, selection.toString(), candidates, matcher, - ContactMatcher.MATCHING_ALGORITHM_EXACT); + ContactMatcher.MATCHING_ALGORITHM_EXACT, String.valueOf(PRIMARY_HIT_LIMIT)); } /** @@ -1021,9 +1024,14 @@ public class ContactAggregator implements ContactAggregationScheduler.Aggregator if (!firstLetters.contains(firstLetter)) { firstLetters.add(firstLetter); final String selection = "(" + NameLookupColumns.NORMALIZED_NAME + " GLOB '" - + firstLetter + "*')"; + + firstLetter + "*') AND " + + NameLookupColumns.NAME_TYPE + " IN(" + + NameLookupType.NAME_COLLATION_KEY + "," + + NameLookupType.EMAIL_BASED_NICKNAME + "," + + NameLookupType.NICKNAME + ")"; matchAllCandidates(db, selection, candidates, matcher, - ContactMatcher.MATCHING_ALGORITHM_APPROXIMATE); + ContactMatcher.MATCHING_ALGORITHM_APPROXIMATE, + String.valueOf(FIRST_LETTER_SUGGESTION_HIT_LIMIT)); } } } @@ -1034,9 +1042,9 @@ public class ContactAggregator implements ContactAggregationScheduler.Aggregator * on that data. */ private void matchAllCandidates(SQLiteDatabase db, String selection, - MatchCandidateList candidates, ContactMatcher matcher, int algorithm) { + MatchCandidateList candidates, ContactMatcher matcher, int algorithm, String limit) { final Cursor c = db.query(NameLookupQuery.TABLE, NameLookupQuery.COLUMNS, - selection, null, null, null, null, String.valueOf(PRIMARY_HIT_LIMIT)); + selection, null, null, null, null, limit); try { while (c.moveToNext()) { |