mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-03 01:35:08 +02:00
Add Nunicode sqlite extension integration
This commit is contained in:
parent
5b22e945da
commit
501dc938e6
8 changed files with 366 additions and 99 deletions
|
@ -54,13 +54,13 @@ module.exports = {
|
|||
* Search authors
|
||||
*
|
||||
* @param {string} libraryId
|
||||
* @param {string} query
|
||||
* @param {Database.TextQuery} query
|
||||
* @param {number} limit
|
||||
* @param {number} offset
|
||||
* @returns {Promise<Object[]>} oldAuthor with numBooks
|
||||
*/
|
||||
async search(libraryId, query, limit, offset) {
|
||||
const matchAuthor = Database.matchExpression('name', query)
|
||||
const matchAuthor = query.matchExpression('name')
|
||||
const authors = await Database.authorModel.findAll({
|
||||
where: {
|
||||
[Sequelize.Op.and]: [Sequelize.literal(matchAuthor), { libraryId }]
|
||||
|
|
|
@ -975,10 +975,12 @@ module.exports = {
|
|||
async search(user, library, query, limit, offset) {
|
||||
const userPermissionBookWhere = this.getUserPermissionBookWhereQuery(user)
|
||||
|
||||
const normalizedQuery = query
|
||||
const textSearchQuery = await Database.createTextSearchQuery(query)
|
||||
|
||||
const matchTitle = Database.matchExpression('title', normalizedQuery)
|
||||
const matchSubtitle = Database.matchExpression('subtitle', normalizedQuery)
|
||||
const matchTitle = textSearchQuery.matchExpression('title')
|
||||
const matchSubtitle = textSearchQuery.matchExpression('subtitle')
|
||||
Logger.debug(`[libraryItemsBookFilters] matchTitle: ${matchTitle}`)
|
||||
Logger.debug(`[libraryItemsBookFilters] matchSubtitle: ${matchSubtitle}`)
|
||||
|
||||
// Search title, subtitle, asin, isbn
|
||||
const books = await Database.bookModel.findAll({
|
||||
|
@ -1041,7 +1043,7 @@ module.exports = {
|
|||
})
|
||||
}
|
||||
|
||||
const matchJsonValue = Database.matchExpression('json_each.value', normalizedQuery)
|
||||
const matchJsonValue = textSearchQuery.matchExpression('json_each.value')
|
||||
|
||||
// Search narrators
|
||||
const narratorMatches = []
|
||||
|
@ -1095,7 +1097,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
// Search series
|
||||
const matchName = Database.matchExpression('name', normalizedQuery)
|
||||
const matchName = textSearchQuery.matchExpression('name')
|
||||
const allSeries = await Database.seriesModel.findAll({
|
||||
where: {
|
||||
[Sequelize.Op.and]: [
|
||||
|
@ -1136,7 +1138,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
// Search authors
|
||||
const authorMatches = await authorFilters.search(library.id, normalizedQuery, limit, offset)
|
||||
const authorMatches = await authorFilters.search(library.id, textSearchQuery, limit, offset)
|
||||
|
||||
return {
|
||||
book: itemMatches,
|
||||
|
|
|
@ -315,9 +315,10 @@ module.exports = {
|
|||
async search(user, library, query, limit, offset) {
|
||||
const userPermissionPodcastWhere = this.getUserPermissionPodcastWhereQuery(user)
|
||||
|
||||
const normalizedQuery = query
|
||||
const matchTitle = Database.matchExpression('title', normalizedQuery)
|
||||
const matchAuthor = Database.matchExpression('author', normalizedQuery)
|
||||
const textSearchQuery = await Database.createTextSearchQuery(query)
|
||||
|
||||
const matchTitle = textSearchQuery.matchExpression('title')
|
||||
const matchAuthor = textSearchQuery.matchExpression('author')
|
||||
|
||||
// Search title, author, itunesId, itunesArtistId
|
||||
const podcasts = await Database.podcastModel.findAll({
|
||||
|
@ -366,7 +367,7 @@ module.exports = {
|
|||
})
|
||||
}
|
||||
|
||||
const matchJsonValue = Database.matchExpression('json_each.value', normalizedQuery)
|
||||
const matchJsonValue = textSearchQuery.matchExpression('json_each.value')
|
||||
|
||||
// Search tags
|
||||
const tagMatches = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue