Kenmei entries to match.
Map of search keys to AniList candidates.
Partial config to override defaults.
Promise resolving to array of match results (one per Kenmei entry).
export async function processBatchMatches(
kenmeiMangaList: KenmeiManga[],
anilistMangaMap: Map<string, AniListManga[]>,
config: Partial<MatchEngineConfig> = {},
): Promise<MangaMatchResult[]> {
console.info(
`[MatchEngine] 🔍 Processing batch matches for ${kenmeiMangaList.length} manga entries`,
);
console.debug(
`[MatchEngine] 🔍 AniList manga map contains ${anilistMangaMap.size} search keys`,
);
const results = kenmeiMangaList.map((kenmeiManga) => {
const searchKey = normalizeString(kenmeiManga.title).slice(0, 10);
const potentialMatches = anilistMangaMap.get(searchKey) || [];
return findBestMatches(kenmeiManga, potentialMatches, config);
});
const matchedCount = results.filter(
(r) => r.anilistMatches && r.anilistMatches.length > 0,
).length;
console.info(
`[MatchEngine] ✅ Batch processing complete: ${matchedCount}/${kenmeiMangaList.length} with matches`,
);
return results;
}
Processes a batch of Kenmei manga entries, finding best AniList matches for each.
Groups AniList candidates by normalized title prefix (first 10 chars) for efficient lookup. Logs progress and completion statistics.