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);
subtoken.replace(":", " ");
subtoken = subtoken.trimmed();
if (!subtoken.isEmpty())
query += "fts" + columntoken + subtoken + "* ";
if (!subtoken.isEmpty()) {
if (!query.isEmpty()) query.append(" ");
query += "fts" + columntoken + "\"" + subtoken + "\"*";
}
}
else {
token.replace(":", " ");
token = token.trimmed();
query += token + "* ";
if (!query.isEmpty()) query.append(" ");
query += "\"" + token + "\"*";
}
}
else {
query += token + "* ";
if (!query.isEmpty()) query.append(" ");
query += "\"" + token + "\"*";
}
}
if (!query.isEmpty()) {