@@ -698,11 +698,15 @@ abstract class AutocompleteQuery {
698
698
699
699
late final List <String > _lowercaseWords;
700
700
701
- /// Whether all of this query's words have matches in [words] that appear in order.
701
+ /// Whether all of this query's words have matches in [words] ,
702
+ /// modulo case, that appear in order.
702
703
///
703
704
/// A "match" means the word in [words] starts with the query word.
705
+ ///
706
+ /// [words] must all be lowercased.
704
707
bool _testContainsQueryWords (List <String > words) {
705
- // TODO(#237) test with diacritics stripped, where appropriate
708
+ // TODO(#237) test with diacritics stripped, where appropriate,
709
+ // and update dartdoc's summary line and its restriction about [words].
706
710
int wordsIndex = 0 ;
707
711
int queryWordsIndex = 0 ;
708
712
while (true ) {
@@ -774,7 +778,7 @@ class MentionAutocompleteQuery extends ComposeAutocompleteQuery {
774
778
}
775
779
776
780
bool _testName (User user, AutocompleteDataCache cache) {
777
- return _testContainsQueryWords (cache.nameWordsForUser (user));
781
+ return _testContainsQueryWords (cache.normalizedNameWordsForUser (user));
778
782
}
779
783
780
784
/// A measure of a wildcard result's quality in the context of the query,
@@ -827,20 +831,21 @@ extension WildcardMentionOptionExtension on WildcardMentionOption {
827
831
class AutocompleteDataCache {
828
832
final Map <int , String > _normalizedNamesByUser = {};
829
833
830
- /// The lowercase `fullName` of [user] .
834
+ /// The normalized `fullName` of [user] .
831
835
String normalizedNameForUser (User user) {
832
836
return _normalizedNamesByUser[user.userId] ?? = user.fullName.toLowerCase ();
833
837
}
834
838
835
- final Map <int , List <String >> _nameWordsByUser = {};
839
+ final Map <int , List <String >> _normalizedNameWordsByUser = {};
836
840
837
- List <String > nameWordsForUser (User user) {
838
- return _nameWordsByUser[user.userId] ?? = normalizedNameForUser (user).split (' ' );
841
+ List <String > normalizedNameWordsForUser (User user) {
842
+ return _normalizedNameWordsByUser[user.userId]
843
+ ?? = normalizedNameForUser (user).split (' ' );
839
844
}
840
845
841
846
void invalidateUser (int userId) {
842
847
_normalizedNamesByUser.remove (userId);
843
- _nameWordsByUser .remove (userId);
848
+ _normalizedNameWordsByUser .remove (userId);
844
849
}
845
850
}
846
851
0 commit comments