diff --git a/client/components/cards/AudiobookSearchCard.vue b/client/components/cards/AudiobookSearchCard.vue index be8420f0..159f02b0 100644 --- a/client/components/cards/AudiobookSearchCard.vue +++ b/client/components/cards/AudiobookSearchCard.vue @@ -1,5 +1,5 @@ @@ -70,6 +70,7 @@ export default { if (this.matchKey === 'tags') return `

Tags: ${html}

` if (this.matchKey === 'authorFL') return `by ${html}` + if (this.matchKey === 'isbn') return `

ISBN: ${html}

` if (this.matchKey === 'series') return `

Series: ${html}

` return `${html}` } diff --git a/server/objects/Book.js b/server/objects/Book.js index 34109475..f60215bc 100644 --- a/server/objects/Book.js +++ b/server/objects/Book.js @@ -43,6 +43,7 @@ class Book { get _authorsList() { return this._author.split(', ') } get _narratorsList() { return this._narrator.split(', ') } get _genres() { return this.genres || [] } + get _isbn() { return this.isbn || '' } get shouldSearchForCover() { if (this.cover) return false @@ -279,7 +280,11 @@ class Book { // var authorMatch = this._author.toLowerCase().includes(search) var seriesMatch = this._series.toLowerCase().includes(search) - var bookMatchKey = titleMatch ? 'title' : subtitleMatch ? 'subtitle' : authorsMatched.length ? 'authorFL' : seriesMatch ? 'series' : false + // ISBN match has to be exact to prevent isbn matches to flood results. Remove dashes since isbn might have those + var isbnMatch = this._isbn.toLowerCase().replace(/-/g, '') === search.replace(/-/g, '') + + var bookMatchKey = titleMatch ? 'title' : subtitleMatch ? 'subtitle' : authorsMatched.length ? 'authorFL' : seriesMatch ? 'series' : isbnMatch ? 'isbn' : false + var bookMatchText = bookMatchKey ? this[bookMatchKey] : '' return { book: bookMatchKey,