Make category searching case insensitive. Only works for ASCII :(
This commit is contained in:
parent
25d2659b93
commit
f4c03c6baa
@ -701,7 +701,10 @@ public class AppProvider extends FDroidProvider {
|
|||||||
return new AppQuerySelection();
|
return new AppQuerySelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
final String selection = CategoryTable.NAME + "." + CategoryTable.Cols.NAME + " = ? ";
|
// Note, the COLLATE NOCASE only works for ASCII columns. The "ICU extension" for SQLite
|
||||||
|
// provides proper case management for Unicode characters, but is not something provided
|
||||||
|
// by Android.
|
||||||
|
final String selection = CategoryTable.NAME + "." + CategoryTable.Cols.NAME + " = ? COLLATE NOCASE ";
|
||||||
final String[] args = {category};
|
final String[] args = {category};
|
||||||
return new AppQuerySelection(selection, args);
|
return new AppQuerySelection(selection, args);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ public class CategoryProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected QuerySelection querySingle(String categoryName) {
|
protected QuerySelection querySingle(String categoryName) {
|
||||||
final String selection = getTableName() + "." + Cols.NAME + " = ?";
|
final String selection = getTableName() + "." + Cols.NAME + " = ? COLLATE NOCASE";
|
||||||
final String[] args = {categoryName};
|
final String[] args = {categoryName};
|
||||||
return new QuerySelection(selection, args);
|
return new QuerySelection(selection, args);
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,13 @@ public class CategoryProviderTest extends FDroidProviderTest {
|
|||||||
"com.chicken",
|
"com.chicken",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
assertPackagesInCategory("animal", new String[] {
|
||||||
|
"com.dog",
|
||||||
|
"com.cat",
|
||||||
|
"com.crow",
|
||||||
|
"com.chicken",
|
||||||
|
});
|
||||||
|
|
||||||
assertPackagesInCategory("Bird", new String[]{
|
assertPackagesInCategory("Bird", new String[]{
|
||||||
"com.crow",
|
"com.crow",
|
||||||
"com.chicken",
|
"com.chicken",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user