gui: Perform content search and path search by default

Search for content and paths. Merge lone words for content search.

This behaviour is much more natural than typing "c:()".
Tá an tiomantas seo le fáil i:
2021-12-30 12:17:12 +01:00
tuismitheoir bb5a793300
tiomantas 407ee1210c
D'athraigh 6 comhad le 27 breiseanna agus 10 scriosta

Féach ar an gComhad

@ -166,8 +166,13 @@ void MainWindow::lineEditReturnPressed()
[&, q]()
{
SqliteSearch searcher(db);
this->currentQuery = LooqsQuery::build(q);
return searcher.search(this->currentQuery);
this->contentSearchQuery = LooqsQuery::build(q, TokenType::FILTER_CONTENT_CONTAINS, true);
LooqsQuery filesQuery = LooqsQuery::build(q, TokenType::FILTER_PATH_CONTAINS, false);
QVector<SearchResult> results;
results.append(searcher.search(filesQuery));
results.append(searcher.search(this->contentSearchQuery));
return results;
});
searchWatcher.setFuture(searchFuture);
}
@ -243,7 +248,7 @@ void MainWindow::makePdfPreview(int page)
QVector<QString> wordsToHighlight;
QRegularExpression extractor(R"#("([^"]*)"|(\w+))#");
for(const Token &token : this->currentQuery.getTokens())
for(const Token &token : this->contentSearchQuery.getTokens())
{
if(token.type == FILTER_CONTENT_CONTAINS)
{