diff options
author | Bjorn Bringert <bringert@android.com> | 2009-06-04 15:35:27 +0100 |
---|---|---|
committer | Bjorn Bringert <bringert@android.com> | 2009-06-04 16:12:59 +0100 |
commit | e6c2fdbc4ea2ece95f6c921f8dea6d7778d02bce (patch) | |
tree | c264fbb8d99af4d5adbebe4841daef7915485291 /src | |
parent | 28cbadc80d908da1d91f814e98e1f70aa11b77bb (diff) | |
download | ApplicationsProvider-e6c2fdbc4ea2ece95f6c921f8dea6d7778d02bce.tar.gz |
Remove duplicates from application search suggestions.
Fixes http://b/issue?id=1897530
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/providers/applications/ApplicationsProvider.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/com/android/providers/applications/ApplicationsProvider.java b/src/com/android/providers/applications/ApplicationsProvider.java index f7f2666..5be044b 100644 --- a/src/com/android/providers/applications/ApplicationsProvider.java +++ b/src/com/android/providers/applications/ApplicationsProvider.java @@ -206,13 +206,15 @@ public class ApplicationsProvider extends ContentProvider { + " applicationsLookup.source = " + APPLICATIONS_TABLE + "." + _ID); qb.setProjectionMap(sSearchSuggestionsProjectionMap); qb.appendWhere(buildTokenFilter(query)); + // don't return duplicates when there are two matching tokens for an app + String groupBy = APPLICATIONS_TABLE + "." + _ID; // order first by whether it a full prefix match, then by name - // token_index != 0 is true for non-full prefix matches, + // MIN(token_index) != 0 is true for non-full prefix matches, // and since false (0) < true(1), this expression makes sure // that full prefix matches come first. - String order = "token_index != 0, " + NAME; + String order = "MIN(token_index) != 0, " + NAME; Cursor cursor = qb.query(mDb, projectionIn, selection, selectionArgs, - null, null, order); + groupBy, null, order); return cursor; } |