diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js index 0c5f32d2..4422fa98 100644 --- a/server/finders/BookFinder.js +++ b/server/finders/BookFinder.js @@ -462,6 +462,8 @@ function cleanAuthorForCompares(author) { 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, '') + // remove et al. + cleanAuthor = cleanAuthor.replace(/et al\.?/g, '') return cleanAuthor } diff --git a/test/server/finders/BookFinder.test.js b/test/server/finders/BookFinder.test.js index ed2442c6..5d28bbea 100644 --- a/test/server/finders/BookFinder.test.js +++ b/test/server/finders/BookFinder.test.js @@ -111,6 +111,7 @@ describe('AuthorCandidates', () => { ['adds recognized author if edit distance from candidate is small', 'nicolai gogol', ['nikolai gogol']], ['does not add candidate if edit distance from any recognized author is large', 'nikolai google', []], ['adds normalized recognized candidate (contains redundant spaces)', 'nikolai gogol', ['nikolai gogol']], + ['adds normalized recognized candidate (et al removed)', 'nikolai gogol et al.', ['nikolai gogol']], ['adds normalized recognized candidate (normalized initials)', 'j.k. rowling', ['j. k. rowling']], ].forEach(([name, author, expected]) => it(name, async () => { authorCandidates.add(author)