Check if token is a valid column name in the fts table before treating it as such.
This commit is contained in:
parent
827ed9425c
commit
3f4e8e5b88
@ -48,10 +48,23 @@ LibraryQuery::LibraryQuery(const QueryOptions& options)
|
|||||||
token.remove(')');
|
token.remove(')');
|
||||||
token.remove('"');
|
token.remove('"');
|
||||||
|
|
||||||
if (token.contains(':'))
|
if (token.contains(':')) {
|
||||||
query += "fts" + token + "* ";
|
// Only prefix fts if the token is a valid column name.
|
||||||
else
|
if (Song::kFtsColumns.contains("fts" + token.section(':', 0, 0),
|
||||||
|
Qt::CaseInsensitive)) {
|
||||||
|
// Account for multiple colons.
|
||||||
|
QString columntoken = token.section(
|
||||||
|
':', 0, 0, QString::SectionIncludeTrailingSep);
|
||||||
|
QString subtoken = token.section(':', 1, -1);
|
||||||
|
subtoken.replace(":", " ");
|
||||||
|
query += "fts" + columntoken + subtoken + "* ";
|
||||||
|
} else {
|
||||||
|
token.replace(':', 1, ' ');
|
||||||
|
query += token + "* ";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
query += token + "* ";
|
query += token + "* ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
where_clauses_ << "fts.%fts_table_noprefix MATCH ?";
|
where_clauses_ << "fts.%fts_table_noprefix MATCH ?";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user