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:'
This commit is contained in:
2022-06-04 23:12:58 +02:00
parent 821bed6706
commit a6ddcef0c0
3 changed files with 45 additions and 26 deletions

View File

@ -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();