When querying based on category, use join table.

This commit is contained in:
Peter Serwylo 2016-09-11 12:41:08 +07:00
parent 3e3fdd5c07
commit b2d5bcc94a

View File

@ -740,20 +740,8 @@ public class AppProvider extends FDroidProvider {
}
private AppQuerySelection queryCategory(String category) {
// TODO: In the future, add a new table for categories,
// so we can join onto it.
final String app = getTableName();
final String selection =
app + "." + Cols.CATEGORIES + " = ? OR " + // Only category e.g. "internet"
app + "." + Cols.CATEGORIES + " LIKE ? OR " + // First category e.g. "internet,%"
app + "." + Cols.CATEGORIES + " LIKE ? OR " + // Last category e.g. "%,internet"
app + "." + Cols.CATEGORIES + " LIKE ? "; // One of many categories e.g. "%,internet,%"
final String[] args = {
category,
category + ",%",
"%," + category,
"%," + category + ",%",
};
final String selection = CategoryTable.NAME + "." + CategoryTable.Cols.NAME + " = ? ";
final String[] args = {category};
return new AppQuerySelection(selection, args);
}