Skip to content

Commit

Permalink
Merge pull request BloomBooks#531 from BloomBooks/BL12871_DontHideSL
Browse files Browse the repository at this point in the history
Prevent duplicate filter from errantly hiding SL books (BL-12871) (BloomBooks#531)
  • Loading branch information
hatton authored Jan 10, 2024
2 parents 6202aaf + 1e3517b commit 8ecbc00
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/model/DuplicateBookFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 8ecbc00

Please sign in to comment.