fix: 收敛BangDream自由词搜索匹配

This commit is contained in:
sunlei 2026-06-16 07:54:37 +08:00
parent 4199d68dda
commit 0127628a1e
2 changed files with 7 additions and 1 deletions

View File

@ -278,7 +278,7 @@ export function match(
} }
if (matchesOnlyAll(matches, keyCount)) { if (matchesOnlyAll(matches, keyCount)) {
return matches._all.some((keyword) => return matches._all.every((keyword) =>
targetIncludesAllKeyword(target, keyword), targetIncludesAllKeyword(target, keyword),
); );
} }

View File

@ -38,6 +38,12 @@ describe('BangDream fuzzy search helpers', () => {
expect(match({ _all: ['summer'] }, { title: ['Summer Dive'] }, [])).toBe( expect(match({ _all: ['summer'] }, { title: ['Summer Dive'] }, [])).toBe(
true, true,
); );
expect(
match({ _all: ['fire', 'bird'] }, { title: ['FIRE BIRD'] }, []),
).toBe(true);
expect(
match({ _all: ['fire', 'bird'] }, { title: ['Light a fire'] }, []),
).toBe(false);
expect( expect(
match( match(
{ scoreUpMaxValue: [100], _number: [100] }, { scoreUpMaxValue: [100], _number: [100] },