From 2103edfcdc59d943bb0c31bee8f9d43d129b0c21 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 7 May 2022 20:01:29 -0500 Subject: [PATCH] Update:Max levenshtein distance for matching author names to 3 #572 --- server/finders/AuthorFinder.js | 2 +- server/providers/Audnexus.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/finders/AuthorFinder.js b/server/finders/AuthorFinder.js index 893ed2b5..f1c668a7 100644 --- a/server/finders/AuthorFinder.js +++ b/server/finders/AuthorFinder.js @@ -21,7 +21,7 @@ class AuthorFinder { async findAuthorByName(name, options = {}) { if (!name) return null - const maxLevenshtein = !isNaN(options.maxLevenshtein) ? Number(options.maxLevenshtein) : 2 + const maxLevenshtein = !isNaN(options.maxLevenshtein) ? Number(options.maxLevenshtein) : 3 var author = await this.audnexus.findAuthorByName(name, maxLevenshtein) if (!author || !author.name) { diff --git a/server/providers/Audnexus.js b/server/providers/Audnexus.js index 4d9c4ce2..10cf03b4 100644 --- a/server/providers/Audnexus.js +++ b/server/providers/Audnexus.js @@ -27,7 +27,7 @@ class Audnexus { }) } - async findAuthorByName(name, maxLevenshtein = 2) { + async findAuthorByName(name, maxLevenshtein = 3) { Logger.debug(`[Audnexus] Looking up author by name ${name}`) var asins = await this.authorASINsRequest(name) var matchingAsin = asins.find(obj => levenshteinDistance(obj.name, name) <= maxLevenshtein)