Fix KMP search-as-you-type not returning results as expected

This commit is contained in:
Xon 2026-01-01 01:35:42 +08:00
commit ffda4cbdfd

View file

@ -73,11 +73,12 @@ export class SearchByKMP<T extends object> implements Searcher<T> {
const field = this._fields[k];
if (field in obj && kmpSearch(needle, (obj[field] as string).toLowerCase()) !== -1) {
results.push({
item: obj[field],
item: obj,
score: count,
rank: count + 1,
});
count++;
break;
}
}
}