diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-12-15 17:48:48 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-12-15 17:48:48 -0800 |
commit | 087a7dd150d7f0180e92c47e5a43adfbd8aa91c4 (patch) | |
tree | e253bff5b67bd0262377c0c3ce55cf33a8e76618 /src/github | |
parent | d339b245b9871c4e86322613fdca47a508ec8906 (diff) | |
download | dsub-087a7dd150d7f0180e92c47e5a43adfbd8aa91c4.tar.gz dsub-087a7dd150d7f0180e92c47e5a43adfbd8aa91c4.tar.bz2 dsub-087a7dd150d7f0180e92c47e5a43adfbd8aa91c4.zip |
Fix issue with search sorting. Ex: System is more different than System of a Down than asdfwer because you can change every letter in the jumbled word with less 'cost' than you can remove ' of a Down'. My work around is to just check and see if query is part of the string and return 1 if it is.
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/provider/DSubSearchProvider.java | 3 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/Util.java | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/provider/DSubSearchProvider.java b/src/github/daneren2005/dsub/provider/DSubSearchProvider.java index 30490f17..63bbaaa4 100644 --- a/src/github/daneren2005/dsub/provider/DSubSearchProvider.java +++ b/src/github/daneren2005/dsub/provider/DSubSearchProvider.java @@ -24,6 +24,7 @@ import android.content.ContentValues; import android.database.Cursor; import android.database.MatrixCursor; import android.net.Uri; +import android.util.Log; import java.util.ArrayList; import java.util.Collections; @@ -45,6 +46,8 @@ import github.daneren2005.dsub.util.Util; * @author Sindre Mehus */ public class DSubSearchProvider extends ContentProvider { + private static final String TAG = DSubSearchProvider.class.getSimpleName(); + private static final String RESOURCE_PREFIX = "android.resource://github.daneren2005.dsub/"; private static final String[] COLUMNS = {"_id", SearchManager.SUGGEST_COLUMN_TEXT_1, diff --git a/src/github/daneren2005/dsub/util/Util.java b/src/github/daneren2005/dsub/util/Util.java index e9724ded..7b905d11 100644 --- a/src/github/daneren2005/dsub/util/Util.java +++ b/src/github/daneren2005/dsub/util/Util.java @@ -871,6 +871,10 @@ public final class Util { throw new IllegalArgumentException("Strings must not be null"); } + if(t.toString().toLowerCase().indexOf(s.toString().toLowerCase()) != -1) { + return 1; + } + int n = s.length(); int m = t.length(); |