Page MenuHomePhabricator

[lib] Introduce SentencePrefixSearchIndex
ClosedPublic

Authored by patryk on Aug 22 2023, 2:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 5, 5:47 AM
Unknown Object (File)
Wed, Sep 4, 6:47 PM
Unknown Object (File)
Tue, Sep 3, 1:37 AM
Unknown Object (File)
Sun, Sep 1, 7:25 PM
Unknown Object (File)
Sat, Aug 31, 1:01 AM
Unknown Object (File)
Tue, Aug 27, 2:51 PM
Unknown Object (File)
Mon, Aug 26, 10:51 AM
Unknown Object (File)
Mon, Aug 26, 4:32 AM
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
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.
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