mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Sort case insensitive, date by newest first (#3560)
* Case insensitive search * Fix not adding extra sort when no sort specified. * Using newer version of fvbommel/sortorder package
This commit is contained in:
@@ -1026,7 +1026,7 @@ func (qb *ImageStore) setImageSortAndPagination(q *queryBuilder, findFilter *mod
|
||||
case "path":
|
||||
addFilesJoin()
|
||||
addFolderJoin()
|
||||
sortClause = " ORDER BY folders.path " + direction + ", files.basename " + direction
|
||||
sortClause = " ORDER BY COALESCE(folders.path, '') || COALESCE(files.basename, '') COLLATE NATURAL_CI " + direction
|
||||
case "file_count":
|
||||
sortClause = getCountSort(imageTable, imagesFilesTable, imageIDColumn, direction)
|
||||
case "tag_count":
|
||||
@@ -1039,10 +1039,13 @@ func (qb *ImageStore) setImageSortAndPagination(q *queryBuilder, findFilter *mod
|
||||
case "title":
|
||||
addFilesJoin()
|
||||
addFolderJoin()
|
||||
sortClause = " ORDER BY COALESCE(images.title, files.basename) COLLATE NATURAL_CS " + direction + ", folders.path " + direction
|
||||
sortClause = " ORDER BY COALESCE(images.title, files.basename) COLLATE NATURAL_CI " + direction + ", folders.path COLLATE NATURAL_CI " + direction
|
||||
default:
|
||||
sortClause = getSort(sort, direction, "images")
|
||||
}
|
||||
|
||||
// Whatever the sorting, always use title/id as a final sort
|
||||
sortClause += ", COALESCE(images.title, images.id) COLLATE NATURAL_CI ASC"
|
||||
}
|
||||
|
||||
q.sortAndPagination = sortClause + getPagination(findFilter)
|
||||
|
||||
Reference in New Issue
Block a user