New data model for global search input and search page

This commit is contained in:
advplyr 2022-03-13 12:39:12 -05:00
parent 30f15d3575
commit ea9ec13845
16 changed files with 241 additions and 88 deletions

View file

@ -47,5 +47,18 @@ class PodcastMetadata {
toJSONExpanded() {
return this.toJSON()
}
searchQuery(query) { // Returns key if match is found
var keysToCheck = ['title', 'artist', 'itunesId', 'itunesArtistId']
for (var key of keysToCheck) {
if (this[key] && String(this[key]).toLowerCase().includes(query)) {
return {
matchKey: key,
matchText: this[key]
}
}
}
return null
}
}
module.exports = PodcastMetadata