用于自动完成的简单 Solr 架构问题 [英] Simple Solr schema problem for autocomplete
问题描述
我有一个非常简单的 SQL 表,我想将其导入 Solr,但由于我想要搜索的功能,我无法确定最佳模式.
I have a very simple SQL table that I want to import into Solr but because of the features I want for search I can't determine the best schema.
用户将开始在输入框中输入,在输入 3 个字符后,它将请求发送到服务器并提取最相关的结果,返回前 15 个匹配的 ID 和名称.
The user will start typing into an input box and after 3 characters it will send the request to the server and pull out the most relevant results returning the top 15 matching id and name.
表例)
id | name
----------------
1 | boating magazines
2 | boats weekly
3 | boaters collection
4 | shipping lane
5 | ships today
搜索和预期回报例如)
boa | [1, boating magazines], [2, boaters weekly], [3, boaters collection]
boat | [1, boating magazines], [2, boaters weekly], [3, boaters collection], [4, shipping lane], [5, ships today]
shi | [4, shipping lane], [5, ships today]
ship | [1, boating magazines], [2, boaters weekly], [3, boaters collection], [4, shipping lane], [5, ships today]
boating | [1, boating magazines], [2, boaters weekly], [3, boaters collection], [4, shipping lane], [5, ships today]
(显然这些将作为 xml 返回)
(obviously those would be returned as xml)
有关我如何实现这一目标的任何信息将不胜感激.谢谢.
Any info on how I would achieve this would be appreciated. Thanks.
推荐答案
您可以使用 facet.prefix, TermsComponent 或 NGrams.
You can implement this using either facet.prefix, TermsComponent or NGrams.
其中一篇文章还展示了如何使用 jQuery 绑定它,或者您可以 使用ajax-solr.
One of those articles also shows how to bind it using jQuery or you could use ajax-solr.
顺便说一下,一个特定的autosuggest 组件将被包含在Solr 的下一个版本.
By the way, a specific autosuggest component is to be included in the next release of Solr.
这篇关于用于自动完成的简单 Solr 架构问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!