shared: sqlitesearch: Only order by rank if token is FILTER_CONTENT_CONTAINS
This commit is contained in:
parent
2a024a9b40
commit
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)
|
||||
{
|
||||
@ -154,9 +155,13 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
|
||||
if(isContentSearch)
|
||||
{
|
||||
if(sortSql.isEmpty())
|
||||
{
|
||||
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, "
|
||||
"file.filetype AS filetype FROM file INNER JOIN content ON file.id = content.fileid " +
|
||||
|
Loading…
Reference in New Issue
Block a user