mysqlruby-on-railssolrsunspotsunspot-rails

sunspot solr undefined field type


I'm having a problem with my sunspot and solr. In development it worked like charme but in production I get the following error out of my rails production log:

RSolr::RequestError (Solr Response: undefined field type): app/controllers/search_controller.rb:7:in `index'

I guess it has something to do with the schema.xml. But I'm quite new to solr. So can anybody help me?

OK:
Controller

def index
 unless params[:q].blank?
  @search = Question.search do
    fulltext params[:q]
  end
  @results = @search.results

else
  @results = nil
end
@searchterm = params[:q]

end

model (Question)

...

searchable do
  text :title 
  text :content
end

Solution

  • It sounds like your production Solr instance is not using Sunspot's schema.xml.

    The type field should defined in Sunspot's standard schema.xml, and it is used to index the model name of the object, for later use in filtering your searches. Seeing an error message saying that type is undefined is what implies to me that you're using a schema.xml other than Sunspot's.

    It could be that you're using some other sample or default set of configurations from the method you used to install Solr on your server. If you can, please elaborate on how you set up your production Solr server.