The manga to evaluate
The match score (0-1)
Current results array for context
OptionalkenmeiManga: KenmeiMangaOptional Kenmei manga for custom rule evaluation
Inclusion decision with potentially adjusted score
export function shouldIncludeMangaRegular(
manga: AniListManga,
score: number,
results: AniListManga[],
kenmeiManga?: KenmeiManga,
): InclusionResult {
// Check custom accept rules if kenmeiManga provided
if (kenmeiManga) {
const { shouldAccept, matchedRule } = shouldAcceptByCustomRules(
manga,
kenmeiManga,
);
if (shouldAccept) {
console.debug(
`[MangaSearchService] ✅ Auto-accepting manga "${manga.title?.romaji || manga.title?.english}" due to custom rule: ${matchedRule?.description}`,
);
return {
shouldInclude: true,
adjustedScore: Math.max(score, ACCEPT_RULE_CONFIDENCE_FLOOR_REGULAR), // Boost to high confidence
};
}
}
if (score > 0.15 || results.length <= 2) {
console.debug(
`[MangaSearchService] ✅ Including manga "${manga.title?.romaji || manga.title?.english}" with score: ${score}`,
);
return { shouldInclude: true, adjustedScore: score };
} else {
console.debug(
`[MangaSearchService] ❌ Excluding manga "${manga.title?.romaji || manga.title?.english}" with score: ${score} (below threshold)`,
);
return { shouldInclude: false, adjustedScore: score };
}
}
Determines if a manga should be included in regular (non-exact) match results. Applies lenient threshold (0.15+) and custom accept rules for priority inclusion.