From 1e3517badabc398ad7ad8374ba86d048446a5a9e Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Thu, 4 Jan 2024 11:16:01 -0700 Subject: [PATCH] Prevent duplicate filter from errantly hiding SL books (BL-12871) --- src/model/DuplicateBookFilter.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/model/DuplicateBookFilter.ts b/src/model/DuplicateBookFilter.ts index 61d52adf..db9e214c 100644 --- a/src/model/DuplicateBookFilter.ts +++ b/src/model/DuplicateBookFilter.ts @@ -41,12 +41,23 @@ export function PreferBooksWithL1MatchingFocusLanguage_DuplicateBookFilter( for (const book of books) { let hash = book.phashOfFirstContentImage; if (languageInFocus) { - const titleInContextLang = getBookTitleInLanguageOrUndefined( + let titleInContextLang = getBookTitleInLanguageOrUndefined( book, languageInFocus ); - if (!titleInContextLang && languageInFocus !== kTagForNoLanguage) { - continue; // just skip it. There are surprisingly many books that have some English but don't have the title in English. E.g. 6jFUJ8jeEv + if (!titleInContextLang) { + if (book.features.includes("signLanguage")) { + // Sign language books don't have a title in the sign language. + titleInContextLang = getBookTitleInLanguageOrUndefined( + book, + book.lang1Tag || "en" + ); + if (!titleInContextLang) { + titleInContextLang = book.allTitles?.[0] ?? ""; + } + } else if (languageInFocus !== kTagForNoLanguage) { + continue; // just skip it. There are surprisingly many books that have some English but don't have the title in English. E.g. 6jFUJ8jeEv + } } hash += (titleInContextLang ?? "").toLowerCase(); }