Use quotes in collection query to allow special characters

Fixes #492
This commit is contained in:
Jonas Kvinge 2020-07-29 21:41:35 +02:00
parent 4c028c1659
commit dd6e254e4f
1 changed files with 8 additions and 4 deletions

View File

@ -65,17 +65,21 @@ CollectionQuery::CollectionQuery(const QueryOptions &options)
QString subtoken = token.section(':', 1, -1); QString subtoken = token.section(':', 1, -1);
subtoken.replace(":", " "); subtoken.replace(":", " ");
subtoken = subtoken.trimmed(); subtoken = subtoken.trimmed();
if (!subtoken.isEmpty()) if (!subtoken.isEmpty()) {
query += "fts" + columntoken + subtoken + "* "; if (!query.isEmpty()) query.append(" ");
query += "fts" + columntoken + "\"" + subtoken + "\"*";
}
} }
else { else {
token.replace(":", " "); token.replace(":", " ");
token = token.trimmed(); token = token.trimmed();
query += token + "* "; if (!query.isEmpty()) query.append(" ");
query += "\"" + token + "\"*";
} }
} }
else { else {
query += token + "* "; if (!query.isEmpty()) query.append(" ");
query += "\"" + token + "\"*";
} }
} }
if (!query.isEmpty()) { if (!query.isEmpty()) {