From dd6e254e4f65a841657c61a023ca5702f5de072a Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Wed, 29 Jul 2020 21:41:35 +0200 Subject: [PATCH] Use quotes in collection query to allow special characters Fixes #492 --- src/collection/collectionquery.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/collection/collectionquery.cpp b/src/collection/collectionquery.cpp index ce81faba4..f8162c6d2 100644 --- a/src/collection/collectionquery.cpp +++ b/src/collection/collectionquery.cpp @@ -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()) {