From 87e543b5ef9bebaf8511e053f79823179a70dcc0 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 26 Jul 2019 19:14:15 +0200 Subject: [PATCH] Fix collection query --- src/collection/collectionquery.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/collection/collectionquery.cpp b/src/collection/collectionquery.cpp index e23ce6f62..914af025a 100644 --- a/src/collection/collectionquery.cpp +++ b/src/collection/collectionquery.cpp @@ -62,7 +62,8 @@ CollectionQuery::CollectionQuery(const QueryOptions &options) QString subtoken = token.section(':', 1, -1); subtoken.replace(":", " "); subtoken = subtoken.trimmed(); - query += "fts" + columntoken + subtoken + "* "; + if (!subtoken.isEmpty()) + query += "fts" + columntoken + subtoken + "* "; } else { token.replace(":", " "); @@ -74,10 +75,11 @@ CollectionQuery::CollectionQuery(const QueryOptions &options) query += token + "* "; } } - - where_clauses_ << "fts.%fts_table_noprefix MATCH ?"; - bound_values_ << query; - join_with_fts_ = true; + if (!query.isEmpty()) { + where_clauses_ << "fts.%fts_table_noprefix MATCH ?"; + bound_values_ << query; + join_with_fts_ = true; + } } if (options.max_age() != -1) {