Skip to content

Commit 4af2411

Browse files
committed
Avoid trimming search tokens
There is no point since we split on spaces so there could not be any spaces in a token. Also move the empty string check into the previous loop to avoid pointlessly adding it to the second slice.
1 parent 8ddfe86 commit 4af2411

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

database/nodb.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,13 @@ func getMatches(extension *noDBExtension, filter Filter) (bool, []int) {
197197
parts := strings.SplitN(token, ":", 2)
198198
if len(parts) == 2 && parts[0] == "publisher" {
199199
match(strings.EqualFold(extension.Publisher.PublisherName, strings.Trim(parts[1], "\"")))
200-
} else {
200+
} else if token != "" {
201201
searchTokens = append(searchTokens, token)
202202
}
203203
}
204204
candidates := []string{extension.Name, extension.Publisher.PublisherName, extension.ShortDescription}
205205
allMatches := fuzzy.Ranks{}
206206
for _, token := range searchTokens {
207-
token = strings.TrimSpace(token)
208-
if token == "" {
209-
continue
210-
}
211207
matches := fuzzy.RankFindFold(token, candidates)
212208
if len(matches) == 0 {
213209
// If even one token does not match all the matches are invalid.

0 commit comments

Comments
 (0)