xapian 自动完成
有人使用过 Xapian 来实现自动完成/自动建议功能吗?即在用户输入时提供可能的建议集,即 Google 的自动建议。
我有大约 200 万个短语,我正在考虑使用 Xapian 作为搜索框架。据我了解,这个框架并不是为这种功能而构建的。因此,在深入探讨这一问题之前,我想先了解一些事情 -
- 如果有人尝试过这一点,那么遇到的问题是什么?
- 这是构建这样的东西的正确框架吗?
- 如果我采取了完全错误的方法或错误的框架,那么请提出替代方案。
Has anyone ever used Xapian for implementing an Auto-Complete/Auto-Suggest feature? i.e. providing possible set of suggestions as the user types a.k.a. Google's Auto-Suggest.
I have about 2 million phrases for which I am considering using Xapian as the search framework. As I understand, this framework was not build for this kind of feature. So I would like to know somethings before diving into this -
- If someone has taken a stab at this then what are the problems one encountered?
- Is this the right framework to build something like this?
- If I am taking a totally wrong approach or wrong framework, then please suggest alternatives.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很想知道为什么你认为 xapian 可能不适合这个?
需要检查的一些内容:
您可能需要花一些时间调整查找,以便它们仅在
n
个字母后开始自动完成。对a*
进行部分搜索(基本上是FLAG_PARTIAL
将执行的操作)会损害您的数据库。另外,您只想返回一些结果,并且您需要考虑词干提取等如何工作。
我无法为您提供使其工作的确切方法,但通过一些调整是可能的。如果您知道 xapian 的工作原理,您应该能够以有效的方式进行设置。例如,您可能会考虑创建一个专门用于自动完成的特殊索引,其中您的停用词比平时更多,值和术语更少,等等。
I'm interested to know why you think xapian might not be up for this?
Some things to check out:
You may have to spend some time tuning your look ups so that they only start to autocomplete after
n
letters. Doing a partial search fora*
(basically whatFLAG_PARTIAL
will do) will hammer your database.Also, you'll only want to return a few results, and you'll want to think about how stemming etc will work.
I can't give you an exact way of making it work, but it is possible with some tuning. If you know how xapian works, you should be able to set it up in an efficient way. For example, you might consider creating a special index just for autocomplete, where you have more stop words than you might normally have, fewer values and terms, etc.