shared/gui: Don't consider non-content search results for previews
Not entirely ideal, since we may want to search for 'cake', and look at a preview for 'cake.txt' even if there is no 'cake' inside. But this will do for now
This commit is contained in:
والد
1a39118470
کامیت
451c79088a
@ -489,6 +489,11 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
|||||||
bool exists = pathInfo.exists();
|
bool exists = pathInfo.exists();
|
||||||
if(exists)
|
if(exists)
|
||||||
{
|
{
|
||||||
|
if(!result.wasContentSearch)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(!pathInfo.suffix().contains("htm")) // hack until we can preview them properly...
|
if(!pathInfo.suffix().contains("htm")) // hack until we can preview them properly...
|
||||||
{
|
{
|
||||||
if(PreviewGenerator::get(pathInfo) != nullptr)
|
if(PreviewGenerator::get(pathInfo) != nullptr)
|
||||||
|
@ -7,6 +7,7 @@ class SearchResult
|
|||||||
public:
|
public:
|
||||||
FileData fileData;
|
FileData fileData;
|
||||||
QVector<unsigned int> pages;
|
QVector<unsigned int> pages;
|
||||||
|
bool wasContentSearch = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SEARCHRESULT_H
|
#endif // SEARCHRESULT_H
|
||||||
|
@ -213,6 +213,7 @@ QVector<SearchResult> SqliteSearch::search(const LooqsQuery &query)
|
|||||||
throw LooqsGeneralException("SQL Error: " + dbQuery.lastError().text());
|
throw LooqsGeneralException("SQL Error: " + dbQuery.lastError().text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool contentSearch = query.hasContentSearch();
|
||||||
while(dbQuery.next())
|
while(dbQuery.next())
|
||||||
{
|
{
|
||||||
SearchResult result;
|
SearchResult result;
|
||||||
@ -229,6 +230,7 @@ QVector<SearchResult> SqliteSearch::search(const LooqsQuery &query)
|
|||||||
result.pages.append(page.toUInt());
|
result.pages.append(page.toUInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result.wasContentSearch = contentSearch;
|
||||||
results.append(result);
|
results.append(result);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
بارگذاری…
مرجع در شماره جدید
Block a user