From 0d01fa977d7d9e2cc64d18e338cbcfcd1c31903c Mon Sep 17 00:00:00 2001 From: Albert S Date: Mon, 25 Apr 2022 22:27:46 +0200 Subject: [PATCH] shared: LooqsQuery: Consider " a part of the loneword Strictly speaking a hack, and we may probably need to add more chars here. This mainly fixes the difference between: "one two" and c:("one two") In the first case they are "lonewords", the " does not get picked up. Then, the search results are something not expected. --- shared/looqsquery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/looqsquery.cpp b/shared/looqsquery.cpp index b11137e..a0790fb 100644 --- a/shared/looqsquery.cpp +++ b/shared/looqsquery.cpp @@ -177,7 +177,7 @@ LooqsQuery LooqsQuery::build(QString expression, TokenType loneWordsTokenType, b QStringList loneWords; LooqsQuery result; QRegularExpression rx("((?(\\.|\\w)+):(?\\((?[^\\)]+)\\)|([\\w,])+)|(?AND|OR)" - "|(?!)|(?\\(|\\))|(?\\w+))"); + "|(?!)|(?\\(|\\))|(?[\"\\w]+))"); QRegularExpressionMatchIterator i = rx.globalMatch(expression); auto previousWasBool = [&result] { return !result.tokens.empty() && ((result.tokens.last().type & BOOL) == BOOL); }; auto previousWas = [&result](TokenType t) { return !result.tokens.empty() && (result.tokens.last().type == t); };