mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-19 00:18:56 +01:00
[enhancement] Handle initials in author normalization
This commit is contained in:
parent
b2acdadcea
commit
f3555a12ce
@ -64,7 +64,12 @@ class BookFinder {
|
|||||||
|
|
||||||
cleanAuthorForCompares(author) {
|
cleanAuthorForCompares(author) {
|
||||||
if (!author) return ''
|
if (!author) return ''
|
||||||
return this.replaceAccentedChars(author).toLowerCase()
|
let cleanAuthor = this.replaceAccentedChars(author).toLowerCase()
|
||||||
|
// separate initials
|
||||||
|
cleanAuthor = cleanAuthor.replace(/([a-z])\.([a-z])/g, '$1. $2')
|
||||||
|
// remove middle initials
|
||||||
|
cleanAuthor = cleanAuthor.replace(/(?<=\w\w)(\s+[a-z]\.?)+(?=\s+\w\w)/g, '')
|
||||||
|
return cleanAuthor
|
||||||
}
|
}
|
||||||
|
|
||||||
filterSearchResults(books, title, author, maxTitleDistance, maxAuthorDistance) {
|
filterSearchResults(books, title, author, maxTitleDistance, maxAuthorDistance) {
|
||||||
|
Loading…
Reference in New Issue
Block a user