Fix case-insensitive queries for groups with non-ASCII characters.

Fixes #11464
This commit is contained in:
Greyson Parrelli
2022-03-29 17:30:53 -04:00
committed by Cody Henthorne
parent 77ea2deada
commit 14849d6e45
5 changed files with 11 additions and 9 deletions

View File

@@ -281,16 +281,18 @@ private static final String[] GROUP_PROJECTION = {
return noMetadata && noMembers;
}
public Reader getGroupsFilteredByTitle(String constraint, boolean includeInactive, boolean excludeV1, boolean excludeMms) {
public Reader queryGroupsByTitle(String inputQuery, boolean includeInactive, boolean excludeV1, boolean excludeMms) {
String query;
String[] queryArgs;
String caseInsensitiveQuery = SqlUtil.buildCaseInsensitiveGlobPattern(inputQuery);
if (includeInactive) {
query = TITLE + " LIKE ? AND (" + ACTIVE + " = ? OR " + RECIPIENT_ID + " IN (SELECT " + ThreadDatabase.RECIPIENT_ID + " FROM " + ThreadDatabase.TABLE_NAME + "))";
queryArgs = new String[]{"%" + constraint + "%", "1"};
query = TITLE + " GLOB ? AND (" + ACTIVE + " = ? OR " + RECIPIENT_ID + " IN (SELECT " + ThreadDatabase.RECIPIENT_ID + " FROM " + ThreadDatabase.TABLE_NAME + "))";
queryArgs = SqlUtil.buildArgs(caseInsensitiveQuery, 1);
} else {
query = TITLE + " LIKE ? AND " + ACTIVE + " = ?";
queryArgs = new String[]{"%" + constraint + "%", "1"};
query = TITLE + " GLOB ? AND " + ACTIVE + " = ?";
queryArgs = SqlUtil.buildArgs(caseInsensitiveQuery, 1);
}
if (excludeV1) {