mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-15 08:19:37 +00:00
Add:Global library search also searches on podcast episode titles #1363
This commit is contained in:
parent
88bd51e2da
commit
1609f1a499
7 changed files with 45 additions and 20 deletions
|
|
@ -311,14 +311,14 @@ class Book {
|
|||
}
|
||||
|
||||
searchQuery(query) {
|
||||
var payload = {
|
||||
const payload = {
|
||||
tags: this.tags.filter(t => cleanStringForSearch(t).includes(query)),
|
||||
series: this.metadata.searchSeries(query),
|
||||
authors: this.metadata.searchAuthors(query),
|
||||
matchKey: null,
|
||||
matchText: null
|
||||
}
|
||||
var metadataMatch = this.metadata.searchQuery(query)
|
||||
const metadataMatch = this.metadata.searchQuery(query)
|
||||
if (metadataMatch) {
|
||||
payload.matchKey = metadataMatch.matchKey
|
||||
payload.matchText = metadataMatch.matchText
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const Logger = require('../../Logger')
|
||||
const PodcastEpisode = require('../entities/PodcastEpisode')
|
||||
const PodcastMetadata = require('../metadata/PodcastMetadata')
|
||||
const { areEquivalent, copyValue } = require('../../utils/index')
|
||||
const { areEquivalent, copyValue, cleanStringForSearch } = require('../../utils/index')
|
||||
const abmetadataGenerator = require('../../utils/abmetadataGenerator')
|
||||
const { readTextFile } = require('../../utils/fileUtils')
|
||||
const { createNewSortInstance } = require('../../libs/fastSort')
|
||||
|
|
@ -206,9 +206,29 @@ class Podcast {
|
|||
return false
|
||||
}
|
||||
|
||||
searchEpisodes(query) {
|
||||
return this.episodes.filter(ep => ep.searchQuery(query))
|
||||
}
|
||||
|
||||
searchQuery(query) {
|
||||
var payload = this.metadata.searchQuery(query)
|
||||
return payload || {}
|
||||
const payload = {
|
||||
tags: this.tags.filter(t => cleanStringForSearch(t).includes(query)),
|
||||
matchKey: null,
|
||||
matchText: null
|
||||
}
|
||||
const metadataMatch = this.metadata.searchQuery(query)
|
||||
if (metadataMatch) {
|
||||
payload.matchKey = metadataMatch.matchKey
|
||||
payload.matchText = metadataMatch.matchText
|
||||
} else {
|
||||
const matchingEpisodes = this.searchEpisodes(query)
|
||||
if (matchingEpisodes.length) {
|
||||
payload.matchKey = 'episode'
|
||||
payload.matchText = matchingEpisodes[0].title
|
||||
}
|
||||
}
|
||||
|
||||
return payload
|
||||
}
|
||||
|
||||
checkHasEpisode(episodeId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue