Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): Implement the “fuzzy match room name” filter #2335

Merged
merged 4 commits into from
Jul 27, 2023

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Jul 26, 2023

Address #1911.

This patch implements a new pre-defined filter for room list entries: room_list_service::filters::fuzzy_match_room_name.

The idea is that all filters can be build via a new_filter function, which produces a closure Fn(&RoomListEntry) -> bool + Send + Sync + 'static.

For fuzzy_match_room_name, I'm using fuzzy_matcher from the skim project. It's battle-tested and widely used via skim. However, it works on char, and no Unicode transformations are applied. So, looking for stf won't match Ștefan —even with smart case/ignore case— for instance, because S is different from Ș.

So before matching the pattern over the subject, we apply some transformations. I wanted to do some transliteration + normalization.
Ideally, I wanted to use icu4x. The transliteration API isn't implemented yet, so I'll just use the normalization API. However, those dependencies can be quite heavy. Looking inside our dependencies, we see that url is using idna, which uses unicode-normalization, it's a project from @unicode-rs, not from @unicode-org. unicode-normalization is slower than icu4x but it's already in our tree of deps, so let's use it. Let's measure and see if speed could be a problem here.

This patch then adds a filters::normalize_string to run some transformations (NFD + filter out combining marks).

Let's see if this approach suits for most common needs for all languages and cultures.

This patch doesn't implement the bindings for entries_filtered to FFI yet, it will be done in another PR.

@Hywan Hywan mentioned this pull request Jul 26, 2023
62 tasks
@Hywan Hywan force-pushed the feat-ui-roomlist-entries-filtered branch from 1dcdf6c to 3e93bdb Compare July 27, 2023 07:20
@Hywan Hywan marked this pull request as ready for review July 27, 2023 07:56
@Hywan Hywan requested a review from a team as a code owner July 27, 2023 07:56
@Hywan Hywan requested review from jplatte and removed request for a team July 27, 2023 07:56
@Hywan Hywan force-pushed the feat-ui-roomlist-entries-filtered branch from 5207e54 to 38a8ad0 Compare July 27, 2023 08:10
@Hywan Hywan merged commit c2a8fbd into matrix-org:main Jul 27, 2023
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants