sunspot_autocomplete icon indicating copy to clipboard operation
sunspot_autocomplete copied to clipboard

RSolr::Error::Http - 400 Bad Request Error: ERROR:unknown field 'tags_ac'

Open MazenAly opened this issue 13 years ago • 4 comments

Hello everyone !!
i did what's written : but when i try to reindex.. i have this error : rake aborted! RSolr::Error::Http - 400 Bad Request Error: ERROR:unknown field 'tags_ac'

as the model that 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 what's the problem guys ? Thanks a lot :)

MazenAly avatar Sep 10 '12 20:09 MazenAly

I think the problem should be in the declaration autocomplete :tags, :using => :tags

that should be changed in this way: autocomplete :classname_tags, :using => :tags

for example, the configuration for my Account class is:

class Account
  include Sunspot::Mongoid
  searchable do
    autocomplete :account_username, :using => :username

    text :username
    text :first_name
    text :last_name
  end
end

xponrails avatar Sep 11 '12 11:09 xponrails

yes it worked now Thanks a lot .. but i have another problem ..in the last step i put in the view file

<%= autocomplete_text_field "experience", "tags", "http://127.0.0.1:8983/solr/", "experience_tags"%>

it appears in the browser like this :

and not a text box !!

i want the autocomplete text box and also i want to put it in a form which will pass the query to the controller .. just like this :

<%= form_tag experiences_path, :method => :get do %>

// the autocomplete box should replace this

<%= submit_tag "Search", :name => nil %>

Thanks a lot man for your help :)

MazenAly avatar Sep 12 '12 17:09 MazenAly

Hi.

I think you are missin the raw helper.

<%= raw autocomplete_text_field 

xponrails avatar Sep 17 '12 14:09 xponrails

TL;DR: Solr seems to crash because of some corrupt contents in the solr/data folder. So delete it, stop solr, start it again, and reindex to create the solr/data folder again.

What worked for me was deleting the solr/ folder, and then starting solr again so that it would generate that folder again. I then replaced the solr/conf folder with my backed up version. Git status says that nothing has changed, so I presume the change that actually did the trick was the newly generated solr/data folder (which is in my .gitignore).

redbar0n avatar Dec 11 '14 18:12 redbar0n