shared: sqlitesearch: reformat - no functional change

This commit is contained in:
Albert S. 2020-12-19 12:40:27 +01:00
parent a6f73d724a
commit 344eaa402e

View File

@ -37,7 +37,6 @@ QString SqliteSearch::fieldToColumn(QueryField field)
return ""; return "";
} }
QString SqliteSearch::createSortSql(const QVector<SortCondition> sortConditions) QString SqliteSearch::createSortSql(const QVector<SortCondition> sortConditions)
{ {
QString sortsql; QString sortsql;
@ -116,7 +115,8 @@ QPair<QString, QVector<QString>> SqliteSearch::createSql(const Token &token)
} }
if(token.type == FILTER_CONTENT_CONTAINS) if(token.type == FILTER_CONTENT_CONTAINS)
{ {
return { " content.id IN (SELECT content_fts.ROWID FROM content_fts WHERE content_fts.content MATCH ?) " , { value } }; return {" content.id IN (SELECT content_fts.ROWID FROM content_fts WHERE content_fts.content MATCH ?) ",
{value}};
} }
throw QSSGeneralException("Unknown token passed (should not happen)"); throw QSSGeneralException("Unknown token passed (should not happen)");
} }
@ -146,7 +146,10 @@ QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query)
{ {
sortSql = "ORDER BY file.mtime DESC, content.page ASC"; sortSql = "ORDER BY file.mtime DESC, content.page ASC";
} }
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 WHERE 1=1 AND " + whereSql + " GROUP BY file.path " + sortSql; 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 WHERE 1=1 AND " +
whereSql + " GROUP BY file.path " + sortSql;
} }
else else
{ {
@ -154,7 +157,9 @@ QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query)
{ {
sortSql = "ORDER BY file.mtime DESC"; sortSql = "ORDER BY file.mtime DESC";
} }
prepSql = "SELECT file.path AS path, '0' as pages, file.mtime AS mtime, file.size AS size, file.filetype AS filetype FROM file WHERE 1=1 AND " + whereSql + " " + sortSql; prepSql = "SELECT file.path AS path, '0' as pages, file.mtime AS mtime, file.size AS size, file.filetype AS "
"filetype FROM file WHERE 1=1 AND " +
whereSql + " " + sortSql;
} }
QSqlQuery dbquery(*db); QSqlQuery dbquery(*db);
@ -169,8 +174,6 @@ QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query)
return dbquery; return dbquery;
} }
QVector<SearchResult> SqliteSearch::search(const QSSQuery &query) QVector<SearchResult> SqliteSearch::search(const QSSQuery &query)
{ {
QVector<SearchResult> results; QVector<SearchResult> results;