You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix mention suggestion filter to use substring matching instead of fuzzy Levenshtein filtering. The previous implementation filtered by Levenshtein distance < threshold, causing short queries like @jc to match unrelated names (e.g. "Aleksandar") because the distance was below the cutoff. Now filters by substring containment and sorts by Levenshtein distance, aligning with the Swift SDK.
Copy file name to clipboardExpand all lines: stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/query/filter/DefaultQueryFilter.kt
+16-77Lines changed: 16 additions & 77 deletions
Original file line number
Diff line number
Diff line change
@@ -29,20 +29,19 @@ import kotlin.math.min
29
29
/**
30
30
* Default implementation of [QueryFilter].
31
31
*
32
-
* This implementation of [QueryFilter] ignores upper case, diacritics
33
-
* It uses levenshtein approximation so typos are included in the search.
32
+
* Keeps only items whose normalized target contains the normalized query as a substring, then
33
+
* sorts results by Levenshtein distance so the closest matches appear first. Normalization
34
+
* applies lowercasing, diacritics removal, and optional transliteration.
34
35
*
35
-
* It is possible to choose a transliteration by providing a [transliterator].
36
-
*
37
-
* @param transliterator The transliterator to use for transliterating the query string.
38
-
* @param target The function to extract the target string from the item.
36
+
* @param transliterator The transliterator to use for normalizing strings.
37
+
* @param target The function to extract the searchable string from an item.
0 commit comments