shared: LooqsQuery: Fix logic of implicit AND booleans. Add 'limit:' support

Add implicit AND booleans at the end.

This fixes a number of issues in LooqsQuery:

(1) A query like a b c p:(something) would fail, because
a b c get merged into one word. This happens at the end.

lonewords are special and do not become a token immediatly. So previous
logic to add implicit ANDs does not apply.

(2) Negations were also broken with lonewords.

(3) The TokenType enum fields were too narrow to be useful for the bitmask

Independent of that, add support for 'limit:'
这个提交包含在:
2022-06-04 23:12:58 +02:00
父节点 821bed6706
当前提交 a6ddcef0c0
修改 3 个文件,包含 45 行新增26 行删除

查看文件

@@ -40,6 +40,7 @@ class LooqsQuery
/* Helper field to determine quertype as well as to quickly check what kind of filters etc.
* are being used in this query*/
int tokensMask = 0;
int limit = -1;
QVector<Token> tokens;
QVector<SortCondition> sortConditions;
void addToken(Token t);
@@ -52,6 +53,14 @@ class LooqsQuery
{
return tokensMask;
}
int getLimit() const
{
return limit;
}
void setLimit(int limit)
{
this->limit = limit;
}
bool hasContentSearch();
bool hasPathSearch();