gui: mainwindow: Revert pathsQuery to original behaviour
Since 7c5c91e
we wrongly merge lone words for paths queries too.
This creates unintended behaviour.
Fix it by creating a new paths query without merged words, which
restores the original behaviour.
Also, get rid of some redundant calls to createFinalTokens()
This commit is contained in:
parent
052f169ef2
commit
77f5c7e39d
@ -508,7 +508,6 @@ void MainWindow::lineEditReturnPressed()
|
|||||||
LooqsQuery pathsQuery = tmpQuery;
|
LooqsQuery pathsQuery = tmpQuery;
|
||||||
|
|
||||||
this->contentSearchQuery = tmpQuery;
|
this->contentSearchQuery = tmpQuery;
|
||||||
this->contentSearchQuery.setTokens({});
|
|
||||||
|
|
||||||
bool addContentSearch = false;
|
bool addContentSearch = false;
|
||||||
bool addPathSearch = false;
|
bool addPathSearch = false;
|
||||||
@ -526,17 +525,15 @@ void MainWindow::lineEditReturnPressed()
|
|||||||
return tokens;
|
return tokens;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* An explicit search, we just pass it on */
|
/* An explicit search, no lone words. We just pass it on */
|
||||||
if(!(tmpQuery.getTokensMask() & TokenType::WORD))
|
if(!(tmpQuery.getTokensMask() & TokenType::WORD))
|
||||||
{
|
{
|
||||||
if(tmpQuery.hasContentSearch())
|
if(tmpQuery.hasContentSearch())
|
||||||
{
|
{
|
||||||
this->contentSearchQuery.setTokens(createFinalTokens(TokenType::FILTER_CONTENT_CONTAINS));
|
|
||||||
addContentSearch = true;
|
addContentSearch = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->contentSearchQuery.setTokens(createFinalTokens(TokenType::FILTER_PATH_CONTAINS));
|
|
||||||
addPathSearch = true;
|
addPathSearch = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,8 +548,7 @@ void MainWindow::lineEditReturnPressed()
|
|||||||
/* A content search and lone words, e. g. c:("to be or not") ebooks */
|
/* A content search and lone words, e. g. c:("to be or not") ebooks */
|
||||||
else if(tmpQuery.hasContentSearch() && (tmpQuery.getTokensMask() & TokenType::WORD))
|
else if(tmpQuery.hasContentSearch() && (tmpQuery.getTokensMask() & TokenType::WORD))
|
||||||
{
|
{
|
||||||
this->contentSearchQuery = tmpQuery;
|
this->contentSearchQuery = LooqsQuery::build(q, TokenType::FILTER_PATH_CONTAINS, false);
|
||||||
this->contentSearchQuery.setTokens(createFinalTokens(TokenType::FILTER_PATH_CONTAINS));
|
|
||||||
addContentSearch = true;
|
addContentSearch = true;
|
||||||
addPathSearch = false;
|
addPathSearch = false;
|
||||||
}
|
}
|
||||||
@ -560,7 +556,7 @@ void MainWindow::lineEditReturnPressed()
|
|||||||
else if(!tmpQuery.hasPathSearch() && !tmpQuery.hasContentSearch())
|
else if(!tmpQuery.hasPathSearch() && !tmpQuery.hasContentSearch())
|
||||||
{
|
{
|
||||||
this->contentSearchQuery.setTokens(createFinalTokens(TokenType::FILTER_CONTENT_CONTAINS));
|
this->contentSearchQuery.setTokens(createFinalTokens(TokenType::FILTER_CONTENT_CONTAINS));
|
||||||
pathsQuery.setTokens(createFinalTokens(TokenType::FILTER_PATH_CONTAINS));
|
pathsQuery = LooqsQuery::build(q, TokenType::FILTER_PATH_CONTAINS, false);
|
||||||
addContentSearch = true;
|
addContentSearch = true;
|
||||||
addPathSearch = true;
|
addPathSearch = true;
|
||||||
}
|
}
|
||||||
@ -580,6 +576,10 @@ void MainWindow::lineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
results.append(searcher.search(this->contentSearchQuery));
|
results.append(searcher.search(this->contentSearchQuery));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->contentSearchQuery.setTokens({});
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
});
|
});
|
||||||
searchWatcher.setFuture(searchFuture);
|
searchWatcher.setFuture(searchFuture);
|
||||||
|
Loading…
Reference in New Issue
Block a user