Added isbn search

Search now also searches books using isbn.
ISBN match has to be exact to prevent isbn matches to flood results.
This commit is contained in:
ISO-B 2022-01-04 12:20:28 +02:00
parent 4aa6c84252
commit 2f8a90c21a

View File

@ -279,7 +279,11 @@ class Book {
// var authorMatch = this._author.toLowerCase().includes(search) // var authorMatch = this._author.toLowerCase().includes(search)
var seriesMatch = this._series.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().replaceAll('-', '') === search.replaceAll('-', '')
var bookMatchKey = titleMatch ? 'title' : subtitleMatch ? 'subtitle' : authorsMatched.length ? 'authorFL' : seriesMatch ? 'series' : isbnMatch ? 'isbn' : false
var bookMatchText = bookMatchKey ? this[bookMatchKey] : '' var bookMatchText = bookMatchKey ? this[bookMatchKey] : ''
return { return {
book: bookMatchKey, book: bookMatchKey,