diff --git a/shared/looqsquery.h b/shared/looqsquery.h index d26091b..ea6dc37 100644 --- a/shared/looqsquery.h +++ b/shared/looqsquery.h @@ -44,6 +44,13 @@ class LooqsQuery QVector tokens; QVector sortConditions; void addToken(Token t); + void updateTokensMask() + { + for(const Token &t : tokens) + { + this->tokensMask |= t.type; + } + } public: const QVector &getTokens() const; @@ -65,8 +72,34 @@ class LooqsQuery bool hasPathSearch() const; void addSortCondition(SortCondition sc); + + void setTokens(const QVector &tokens) + { + this->tokens = tokens; + updateTokensMask(); + } + static bool checkParanthesis(QString query); static LooqsQuery build(QString query, TokenType loneWordsTokenType, bool mergeLoneWords); + + LooqsQuery() + { + } + + LooqsQuery(const QVector &tokens, const QVector &sortConditions) + { + this->tokens = tokens; + this->sortConditions = sortConditions; + updateTokensMask(); + } + + LooqsQuery(const LooqsQuery &o) + { + this->tokens = o.tokens; + this->sortConditions = o.sortConditions; + this->tokensMask = o.tokensMask; + this->limit = o.limit; + } }; #endif // LOOQSQUERY_H