0
votes

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.

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 :(

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.

2
Could you share how you fixed it ?? I am having the same issueSaurabh

2 Answers

0
votes

i had the same "problem" =)

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)

you can see which one you have in the top of http://localhost:8982/solr/admin/ as SolrHome

hope it helped!

0
votes

I am having a similar problem, but I don't think it was related. However, I did find another version of that article that actually includes the code sections that are missing from OP's link.

https://gist.github.com/2648514

hope that helps!