Page MenuHomePhabricator

[lib] Add userStoreMentionSearchIndex selector
ClosedPublic

Authored by patryk on Aug 22 2023, 2:05 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 16 2024, 12:45 AM
Unknown Object (File)
Nov 9 2024, 4:58 PM
Unknown Object (File)
Nov 9 2024, 4:57 PM
Unknown Object (File)
Nov 9 2024, 1:46 PM
Unknown Object (File)
Nov 9 2024, 1:46 PM
Unknown Object (File)
Nov 9 2024, 10:40 AM
Unknown Object (File)
Oct 24 2024, 3:32 AM
Unknown Object (File)
Oct 21 2024, 9:38 PM
Subscribers

Details

Summary

This diff adds new SearchIndex selector for user mentioning. We need to use SentencePrefixSearchIndex rather than SearchIndex, because SearchIndex catches keywords rather than whole text prefix, so when user would type whole username and then input a space, the tooltip would never close.

Depends on D8900.

Test Plan

Tested later in the stack.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

patryk held this revision as a draft.
patryk edited the test plan for this revision. (Show Details)
patryk added reviewers: tomek, inka.

Why when user would type whole username and then input a space, the tooltip would never close?

D8903 will introduce new regex for detecting when typeahead should be shown (it will catch spaces too). Because of that change, the tooltip would never close.

D8903 will introduce new regex for detecting when typeahead should be shown (it will catch spaces too). Because of that change, the tooltip would never close.

Wouldn't it close when there are no more matches?
Also this changes the behaviour I believe - before a user named "test_user-hello" could be found by typing in "test", "user" or "hello". If I understand correctly it won't be possible anymore? Can you confirm with @ashoat that this is fine?

inka requested changes to this revision.Aug 29 2023, 5:21 AM
This revision now requires changes to proceed.Aug 29 2023, 5:21 AM

Wouldn't it close when there are no more matches?

It would. But as said in a summary:
because SearchIndex catches keywords rather than whole text prefix, when user would type whole username and then input a space, the tooltip would never close. I wrote an example below.

Also this changes the behaviour I believe - before a user named "test_user-hello" could be found by typing in "test", "user" or "hello". If I understand correctly it won't be possible anymore? Can you confirm with @ashoat that this is fine?

Great catch -> but I think we want to search users by its username prefix (see this). I believe that if we do prefix search on thread names, we should do this also for usernames. Using old SearchIndex might bring new issues:
Consider a chat named 'test user chat' and a user with the username 'user'. Since the SearchIndex.getSearchResults tokenizes the query before performing the lookup, if a user were to type 'test', the username of the user would not appear in the tooltip. However, after typing 'test user', the user would then appear in the tooltip.

D8903 will introduce new regex for detecting when typeahead should be shown (it will catch spaces too). Because of that change, the tooltip would never close.

D8903 was abandoned, does this influence this diff? What does the regex look like now?

I can confirm that we're looking to do only prefix search for @-mentions of chats. We'll continue to do a "full text search" for in the "Search chats" experience as well as the message search experience. But the typeahead is meant to be prefix-only

In D8901#267694, @inka wrote:

D8903 will introduce new regex for detecting when typeahead should be shown (it will catch spaces too). Because of that change, the tooltip would never close.

D8903 was abandoned, does this influence this diff? What does the regex look like now?

D8903 does not influence this diff. You can see the regex here: D8910

This revision is now accepted and ready to land.Sep 22 2023, 7:20 AM