LooqsQuery: Add hasContentSearch(),hasPathSearch() convenience functions

This commit is contained in:
Albert S. 2022-01-04 11:09:41 +01:00
vanhempi 1f35e2120e
commit c0657947b1
2 muutettua tiedostoa jossa 14 lisäystä ja 1 poistoa

Näytä tiedosto

@ -23,6 +23,16 @@ QueryType LooqsQuery::getQueryType()
return static_cast<QueryType>(tokensMask & COMBINED);
}
bool LooqsQuery::hasContentSearch()
{
return (this->getTokensMask() & FILTER_CONTENT) == FILTER_CONTENT;
}
bool LooqsQuery::hasPathSearch()
{
return (this->getTokensMask() & FILTER_PATH) == FILTER_PATH;
}
void LooqsQuery::addSortCondition(SortCondition sc)
{
this->sortConditions.append(sc);
@ -312,7 +322,7 @@ LooqsQuery LooqsQuery::build(QString expression, TokenType loneWordsTokenType, b
}
}
bool contentsearch = (result.getTokensMask() & FILTER_CONTENT) == FILTER_CONTENT;
bool contentsearch = result.hasContentSearch();
bool sortsForContent = std::any_of(result.sortConditions.begin(), result.sortConditions.end(),
[](SortCondition c) { return c.field == CONTENT_TEXT; });

Näytä tiedosto

@ -52,6 +52,9 @@ class LooqsQuery
{
return tokensMask;
}
bool hasContentSearch();
bool hasPathSearch();
void addSortCondition(SortCondition sc);
static bool checkParanthesis(QString query);
static LooqsQuery build(QString query, TokenType loneWordsTokenType, bool mergeLoneWords);