mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-28 14:49:38 +00:00
Update:Global library search strips periods, commas and other characters when matching #750
This commit is contained in:
parent
256a9322ef
commit
5b4d3f71f9
8 changed files with 20 additions and 26 deletions
|
|
@ -1,5 +1,5 @@
|
|||
const Logger = require('../../Logger')
|
||||
const { areEquivalent, copyValue } = require('../../utils/index')
|
||||
const { areEquivalent, copyValue, cleanStringForSearch } = require('../../utils/index')
|
||||
const parseNameString = require('../../utils/parsers/parseNameString')
|
||||
class BookMetadata {
|
||||
constructor(metadata) {
|
||||
|
|
@ -342,15 +342,15 @@ class BookMetadata {
|
|||
}
|
||||
|
||||
searchSeries(query) {
|
||||
return this.series.filter(se => se.name.toLowerCase().includes(query))
|
||||
return this.series.filter(se => cleanStringForSearch(se.name).includes(query))
|
||||
}
|
||||
searchAuthors(query) {
|
||||
return this.authors.filter(se => se.name.toLowerCase().includes(query))
|
||||
return this.authors.filter(au => cleanStringForSearch(au.name).includes(query))
|
||||
}
|
||||
searchQuery(query) { // Returns key if match is found
|
||||
var keysToCheck = ['title', 'asin', 'isbn']
|
||||
for (var key of keysToCheck) {
|
||||
if (this[key] && this[key].toLowerCase().includes(query)) {
|
||||
if (this[key] && cleanStringForSearch(String(this[key])).includes(query)) {
|
||||
return {
|
||||
matchKey: key,
|
||||
matchText: this[key]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const Logger = require('../../Logger')
|
||||
const { areEquivalent, copyValue } = require('../../utils/index')
|
||||
const { areEquivalent, copyValue, cleanStringForSearch } = require('../../utils/index')
|
||||
|
||||
class PodcastMetadata {
|
||||
constructor(metadata) {
|
||||
|
|
@ -94,7 +94,7 @@ class PodcastMetadata {
|
|||
searchQuery(query) { // Returns key if match is found
|
||||
var keysToCheck = ['title', 'author', 'itunesId', 'itunesArtistId']
|
||||
for (var key of keysToCheck) {
|
||||
if (this[key] && String(this[key]).toLowerCase().includes(query)) {
|
||||
if (this[key] && cleanStringForSearch(String(this[key])).includes(query)) {
|
||||
return {
|
||||
matchKey: key,
|
||||
matchText: this[key]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue