fix fuzzy search result - to be array as well

This commit is contained in:
Dobromir Popov
2024-02-27 02:44:58 +02:00
parent 5bc7d1ad22
commit af4923ba20
5 changed files with 17 additions and 11 deletions

View File

@ -66,7 +66,7 @@ async function findPublisher(names, email, select, getAll = false) {
if (result.length === 0 && names) {
console.log("No publisher found, trying fuzzy search for '" + names + "'- email: '" + email + "'");
const publishers = await prisma.publisher.findMany();
result = await common.fuzzySearch(publishers, names, 0.90);
result = [await common.fuzzySearch(publishers, names, 0.90)];
console.log("Fuzzy search result: " + result?.firstName + " " + result?.lastName + " - " + result?.email);
}
//always return an array