LooqsQuery::build(): Ensure values are non-empty and ignore empty lone words

This commit is contained in:
Albert S. 2022-01-04 11:07:59 +01:00
parent 404ce22ce6
commit 1f35e2120e
1 changed files with 9 additions and 1 deletions

View File

@ -251,6 +251,10 @@ LooqsQuery LooqsQuery::build(QString expression, TokenType loneWordsTokenType, b
{
value = m.captured("args");
}
if(value == "")
{
throw LooqsGeneralException("value cannot be empty for filters");
}
if(filtername == "path.contains")
{
@ -301,7 +305,11 @@ LooqsQuery LooqsQuery::build(QString expression, TokenType loneWordsTokenType, b
if(mergeLoneWords)
{
result.addToken(Token(loneWordsTokenType, loneWords.join(' ')));
QString mergedLoneWords = loneWords.join(' ');
if(!mergedLoneWords.isEmpty())
{
result.addToken(Token(loneWordsTokenType, mergedLoneWords));
}
}
bool contentsearch = (result.getTokensMask() & FILTER_CONTENT) == FILTER_CONTENT;