440
}
441
442
>
function doScoreItemFuzzyMultiple(label: string, description: string | undefined, path: string | undefined, query: IPreparedQueryPiece[], preferLabelMatches: boolean, allowNonContiguousMatches: boolean): IItemScore {
fuzzyScorer.ts
443
>
let totalScore = 0;
444
>
const totalLabelMatches: IMatch[] = [];
445
>
const totalDescriptionMatches: IMatch[] = [];
446
>
447
>
for (const queryPiece of query) {
448
>
const { score, labelMatch, descriptionMatch } = doScoreItemFuzzySingle(label, description, path, queryPiece, preferLabelMatches, allowNonContiguousMatches);
449
>
if (score === NO_MATCH) {
450
// if a single query value does not match, return with
451
// no score entirely, we require all queries to match
452
return NO_ITEM_SCORE;
453
}
455
>
totalScore += score;
456
>
if (labelMatch) {
457
>
totalLabelMatches.push(...labelMatch);
458
>
}
459
>
460
>
if (descriptionMatch) {
461
totalDescriptionMatches.push(...descriptionMatch);
462
}
464
465
// if we have a score, ensure that the positions are