Skip to content

Commit 19625e0

Browse files
authored
Stop removing 's' (depluralization) from package name matching. (#8696)
1 parent 7d4b8ab commit 19625e0

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

app/lib/search/mem_index.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,10 +619,7 @@ class PackageNameIndex {
619619
IndexedScore<String>? filterOnNonZeros,
620620
}) {
621621
assert(score.keys.length == _packageNames.length);
622-
final singularWord = word.length <= 3 || !word.endsWith('s')
623-
? word
624-
: word.substring(0, word.length - 1);
625-
final lowercasedWord = singularWord.toLowerCase();
622+
final lowercasedWord = word.toLowerCase();
626623
final collapsedWord = _removeUnderscores(lowercasedWord);
627624
final parts =
628625
collapsedWord.length <= 3 ? [collapsedWord] : trigrams(collapsedWord);

app/test/search/maps_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void main() {
3030
'sdkLibraryHits': [],
3131
'packageHits': [
3232
{'package': 'maps', 'score': 1.0},
33-
{'package': 'map', 'score': 1.0},
33+
{'package': 'map', 'score': 0.5},
3434
],
3535
});
3636
});

app/test/search/mem_index_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,8 @@ server.dart adds a small, prescriptive server (PicoServer) that can be configure
562562
final match2 = index.search(
563563
ServiceSearchQuery.parse(query: 'apps', order: SearchOrder.text));
564564
expect(match2.packageHits.map((e) => e.toJson()), [
565-
{'package': 'app', 'score': 1.0},
566565
{'package': 'apps', 'score': 1.0},
566+
{'package': 'app', 'score': 0.5},
567567
]);
568568
});
569569

0 commit comments

Comments
 (0)