如何构建自动完成功能?

时间:2019-04-03 23:51:56

标签: trie application-design web-application-design

功能类似 Google Auto Complete

例如 我有一个叫人名的字段,当用户键入内容时,我们将显示与用户输入内容匹配的所有选项。

我的第一个问题:

which one should maintain trie tree, frontend, backend or both?

第二个问题:

No matter front end or back end, when will trie tree be loaded?
If trie loaded on start, million of entities loaded take a lot time, and huge data in memory.
If trie loaded once user searched, each time user typed is a DB call and a Rest call, which also consumme a lot resources. And at first search, user will see no options till he did once, which is bad user experience.

如果您有想法,请期待!

0 个答案:

没有答案