mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-09-01 08:15:15 +02:00
Fix library query sort by title, add indexes for books and libraryItems
This commit is contained in:
parent
8c9fc3ddb5
commit
aac2879652
3 changed files with 40 additions and 3 deletions
|
@ -257,7 +257,7 @@ module.exports = {
|
|||
if (global.ServerSettings.sortingIgnorePrefix) {
|
||||
return [[Sequelize.literal('titleIgnorePrefix COLLATE NOCASE'), dir]]
|
||||
} else {
|
||||
return [[Sequelize.literal('title COLLATE NOCASE'), dir]]
|
||||
return [[Sequelize.literal('`book`.`title` COLLATE NOCASE'), dir]]
|
||||
}
|
||||
} else if (sortBy === 'sequence') {
|
||||
const nullDir = sortDesc ? 'DESC NULLS FIRST' : 'ASC NULLS LAST'
|
||||
|
@ -546,6 +546,10 @@ module.exports = {
|
|||
distinct: true,
|
||||
attributes: bookAttributes,
|
||||
replacements,
|
||||
benchmark: true,
|
||||
logging: (sql, timeMs) => {
|
||||
console.log(`[Query] Elapsed ${timeMs}ms.`)
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: Database.models.libraryItem,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue