Potential manga matches.
Title of manga being matched.
Configuration with shouldIgnoreOneShots, shouldIgnoreAdultContent.
Kenmei manga for custom rule evaluation.
Optionaloptions: { skipSystemFilters?: boolean }Filtered list of manga matches (with internal accept rule tracking if applicable).
export function applyMatchFiltering(
potentialMatches: AniListManga[],
mangaTitle: string,
matchConfig: Partial<MatchConfig>,
kenmeiManga: KenmeiManga,
options?: { skipSystemFilters?: boolean },
): Array<AniListManga & { matchedAcceptRule?: CustomRule }> {
const sanitizedMatches = filterOutBlacklistedManga(potentialMatches);
let filteredMatches: Array<
AniListManga & { matchedAcceptRule?: CustomRule }
> = sanitizedMatches.map((m) => ({ ...m }));
if (!options?.skipSystemFilters) {
// Apply system content filters (novels, one-shots, adult content)
const systemFiltered = applySystemContentFilters(
filteredMatches,
matchConfig,
kenmeiManga,
mangaTitle,
);
filteredMatches = systemFiltered.map((m) => ({
...m,
})) as Array<AniListManga & { matchedAcceptRule?: CustomRule }>;
}
// Mark matches that satisfy custom accept rules (without removing them)
// Confidence will be boosted later in createMangaMatchResult()
filteredMatches = filteredMatches.map((match) => {
const { shouldAccept, matchedRule } = shouldAcceptByCustomRules(
match,
kenmeiManga,
);
if (shouldAccept && matchedRule) {
console.debug(
`[MangaSearchService] ⭐ Marking confidence boost for "${match.title?.romaji || match.title?.english}" due to custom accept rule: "${matchedRule.description}"`,
);
return { ...match, matchedAcceptRule: matchedRule };
}
return match;
});
return filteredMatches;
}
Filter matches based on configuration rules (one-shots, adult content, custom rules).
Applies user-configured filtering during automatic matching:
Confidence Boost Behavior: When a match satisfies a custom accept rule, it's marked internally. The createMangaMatchResult() function later applies a confidence floor: 85% for exact title matches, 75% otherwise. Skip rules always take precedence - if a match matches both skip and accept rules, it's skipped.