Page MenuHomePhabricator

[lib] Introduce SentencePrefixSearchIndex
ClosedPublic

Authored by patryk on Aug 22 2023, 2:03 AM.
Tags
None
Referenced Files
F3181280: D8899.id30183.diff
Fri, Nov 8, 6:02 AM
Unknown Object (File)
Wed, Oct 23, 6:06 PM
Unknown Object (File)
Sun, Oct 20, 9:33 PM
Unknown Object (File)
Sep 27 2024, 6:27 PM
Unknown Object (File)
Sep 27 2024, 6:27 PM
Unknown Object (File)
Sep 27 2024, 6:27 PM
Unknown Object (File)
Sep 27 2024, 6:27 PM
Unknown Object (File)
Sep 27 2024, 6:27 PM
Subscribers

Details

Summary

Solution for ENG-4556.

This diff introduces new SearchIndex class which operates on text prefixes rather than on keywords.

Depends on D8898.

Test Plan

Tested later in the stack.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

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

Remove useless code

patryk added inline comments.
lib/shared/sentence-prefix-search-index.js
10 ↗(On Diff #30193)

new Tokenizer().words() removes punctuation from keywords, chat names can include them so we need to keep them.

13–19 ↗(On Diff #30193)

How does this work? Rather than storing kewords, we store whole prefixes. Let's take "test chat" name as an example. SearchIndex would store only keywords prefixes:

  • t, te, tes, test
  • c, ch, cha, chat

Using this approach would eventually hide our typeahead tooltip when user would press the space and that's not what we want while typing chat name in input bar while mentioning. New SearchIndex entries look like this:

  • t, te, tes, test, "test ", test c, ..., test chat
  • c, ch, cha, chat
This revision is now accepted and ready to land.Aug 28 2023, 8:10 AM
lib/shared/search-index.js
29 ↗(On Diff #30287)

Not sure if handler is the right name. How about e.g. addAllPrefixes?

lib/shared/sentence-prefix-search-index.js
25–31 ↗(On Diff #30287)

This can be simplified

Rename addEntryHandler to addAllPrefixes and simplify code