Improve page load queries on title, titleIgnorePrefix, and addedAt sort order

This commit is contained in:
mikiher 2025-02-08 12:29:23 +02:00
parent 52bb28669a
commit a13143245b
6 changed files with 363 additions and 9 deletions

View file

@ -73,6 +73,10 @@ class LibraryItem extends Model {
/** @type {Book.BookExpanded|Podcast.PodcastExpanded} - only set when expanded */
this.media
/** @type {string} */
this.title // Only used for sorting
/** @type {string} */
this.titleIgnorePrefix // Only used for sorting
}
/**
@ -677,7 +681,9 @@ class LibraryItem extends Model {
lastScan: DataTypes.DATE,
lastScanVersion: DataTypes.STRING,
libraryFiles: DataTypes.JSON,
extraData: DataTypes.JSON
extraData: DataTypes.JSON,
title: DataTypes.STRING,
titleIgnorePrefix: DataTypes.STRING
},
{
sequelize,
@ -695,6 +701,12 @@ class LibraryItem extends Model {
{
fields: ['libraryId', 'mediaType', 'size']
},
{
fields: ['libraryId', 'mediaType', { name: 'title', collate: 'NOCASE' }]
},
{
fields: ['libraryId', 'mediaType', { name: 'titleIgnorePrefix', collate: 'NOCASE' }]
},
{
fields: ['libraryId', 'mediaId', 'mediaType']
},