MainWindow: Avoid potential double path searches
Šī revīzija ir iekļauta:
vecāks
c0657947b1
revīzija
b10c2edf05
@ -164,12 +164,22 @@ void MainWindow::lineEditReturnPressed()
|
|||||||
[&, q]()
|
[&, q]()
|
||||||
{
|
{
|
||||||
SqliteSearch searcher(db);
|
SqliteSearch searcher(db);
|
||||||
|
QVector<SearchResult> results;
|
||||||
this->contentSearchQuery = LooqsQuery::build(q, TokenType::FILTER_CONTENT_CONTAINS, true);
|
this->contentSearchQuery = LooqsQuery::build(q, TokenType::FILTER_CONTENT_CONTAINS, true);
|
||||||
|
|
||||||
|
/* We can have a path search in contentsearch too (if given explicitly), so no need to do it twice.
|
||||||
|
Make sure path results are listed first. */
|
||||||
|
bool addContentSearch = this->contentSearchQuery.hasContentSearch();
|
||||||
|
bool addPathSearch = !this->contentSearchQuery.hasPathSearch() || !addContentSearch;
|
||||||
|
if(addPathSearch)
|
||||||
|
{
|
||||||
LooqsQuery filesQuery = LooqsQuery::build(q, TokenType::FILTER_PATH_CONTAINS, false);
|
LooqsQuery filesQuery = LooqsQuery::build(q, TokenType::FILTER_PATH_CONTAINS, false);
|
||||||
QVector<SearchResult> results;
|
|
||||||
results.append(searcher.search(filesQuery));
|
results.append(searcher.search(filesQuery));
|
||||||
|
}
|
||||||
|
if(addContentSearch)
|
||||||
|
{
|
||||||
results.append(searcher.search(this->contentSearchQuery));
|
results.append(searcher.search(this->contentSearchQuery));
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
});
|
});
|
||||||
searchWatcher.setFuture(searchFuture);
|
searchWatcher.setFuture(searchFuture);
|
||||||
|
Notiek ielāde…
Atsaukties uz šo jaunā problēmā
Block a user