shared: sqlitesearch: Only order by rank if token is FILTER_CONTENT_CONTAINS
This commit is contained in:
والد
2a024a9b40
کامیت
8194476fa6
@ -133,7 +133,8 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
|
||||
throw LooqsGeneralException("Nothing to search for supplied");
|
||||
}
|
||||
|
||||
for(const Token &token : query.getTokens())
|
||||
auto tokens = query.getTokens();
|
||||
for(const Token &token : tokens)
|
||||
{
|
||||
if(token.type == FILTER_CONTENT_CONTAINS)
|
||||
{
|
||||
@ -155,7 +156,11 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
|
||||
{
|
||||
if(sortSql.isEmpty())
|
||||
{
|
||||
sortSql = "ORDER BY rank";
|
||||
if(std::find_if(tokens.begin(), tokens.end(),
|
||||
[](const Token &t) -> bool { return t.type == FILTER_CONTENT_CONTAINS; }) != tokens.end())
|
||||
{
|
||||
sortSql = "ORDER BY rank";
|
||||
}
|
||||
}
|
||||
prepSql =
|
||||
"SELECT file.path AS path, group_concat(content.page) AS pages, file.mtime AS mtime, file.size AS size, "
|
||||
|
بارگذاری…
مرجع در شماره جدید
Block a user