自动完成在Solr和太阳黑子 [英] autocomplete in Solr and sunspot
问题描述
我在建设有回报率一个网站,我用太阳黑子和Solr的搜索引擎。我需要使用自动填充功能,但我不能。
我知道Solr中有一个名为 suggester新事物但我不知道如何使用这个太阳黑子和一个Rails应用程序。
I'm building a website with RoR and I use Sunspot and the solr Search Engine. I needed to use autocomplete functionality but I couldn't. I knew that Solr has a new thing called suggester but I don't know how to use this with sunspot and in a rails app.
我发现了一个名为 sunspot_autocomplete 宝石,我跟着写着什么,但是当我尝试重新索引我得到这个错误:
I found a gem called sunspot_autocomplete and I followed what was written, but when I try to reindex I get this error :
rake aborted!
RSolr::Error::Http - 400 Bad Request
Error: ERROR:unknown field 'tags_ac'
这就是所谓的搜索模型体验
,我把这个块在它
The model that is searchable called Experience
and I put this block in it
searchable do
text :tags, :boost => 3
text :title, :boost => 2
text :tips
autocomplete :tags, :using => :tags
end
最后,我发现这个博客,这听起来不错,但我不明白:(
Finally I found this blog that it sounds good but I don't understand it :(
<一个href=\"http://www.binrand.com/post/3338898-autocomplete-solr-architecture-rails-3-2-solr-1-4-with-sunspot-solr-gem.html\" rel=\"nofollow\">http://www.binrand.com/post/3338898-autocomplete-solr-architecture-rails-3-2-solr-1-4-with-sunspot-solr-gem.html
我需要你把自动填充功能在我的应用程序的帮助。非常感谢:)
I need your help in putting the autocomplete functionality in my app. Thanks A lot :)
更新:
我终于固定,并提出了演示在这里的搜索框。
Update: I finally fixed and made a demo here in the search box.
推荐答案
我有同样的问题=)
只是确保你有你的Solr模式路径定义的自动完成类型,字段的正确schema.xml中的http://本地主机:8982 / Solr的/管理/文件/文件= schema.xml中
(假设你有本地默认太阳黑子开发环境)
just ensure you have correct schema.xml with "autocomplete" type and fields defined at your solr schema path http://localhost:8982/solr/admin/file/?file=schema.xml
(assuming you have local default sunspot dev environment)
对于我来说,我有另外一个从其他项目中跑在这条道路(和端口)
for me, i had other one from other project ran at this path (and port)
你可以看到你在 HTTP顶部的其中之一://本地主机:8982 / Solr的/管理/
为SolrHome
you can see which one you have in the top of http://localhost:8982/solr/admin/
as SolrHome
希望它帮助!
这篇关于自动完成在Solr和太阳黑子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!