Skip to content

Commit 6cc823d

Browse files
authored
Merge pull request #298 from aws/jurredr/adjust-search-algo
Adjusted context search algo to never include any completely partial results
2 parents f391b2e + eb52222 commit 6cc823d

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/helper/quick-pick-data-handler.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,7 @@ const calculateItemScore = (text: string, searchTerm: string): number => {
126126
if (isWordStartMatch) return 60;
127127
if (isContainsMatch) return 40;
128128

129-
return calculateScore(normalizedText, normalizedTerm);
130-
};
131-
132-
const calculateScore = (text: string, term: string): number => {
133-
let score = 0;
134-
let termIndex = 0;
135-
let consecutiveMatches = 0;
136-
137-
for (let i = 0; i < text.length && termIndex < term.length; i++) {
138-
if (text[i] === term[termIndex]) {
139-
score += 10 + consecutiveMatches;
140-
consecutiveMatches++;
141-
termIndex++;
142-
} else {
143-
consecutiveMatches = 0;
144-
}
145-
}
146-
147-
return termIndex === term.length ? score : 0;
129+
return 0;
148130
};
149131

150132
export const convertDetailedListGroupsToQuickActionCommandGroups = (detailedListItemGroups: DetailedListItemGroup[]): QuickActionCommandGroup[] => {

0 commit comments

Comments
 (0)