Ben Downey
Ben Downey

Reputation: 2665

Solr unable to reindex due to undefined field type

I've inhereted a rails app that uses Solr, which is new to me. All I want to do for now is to get the site running locally. I've installed solar, but when I try to get it running on the app, I have problems. I can run

rake sunspot:solr:start

without getting any errors, but when I try to reindex everything, like this:

rake sunspot:solr:reindex

I get the following error:

Execute sunspot:reindex
rake aborted!
Solr Response: undefined field type

I gather from this post that it's because of the schema.xml file. And that I have to copy that file.

I've got a schema.xml in my app's root directory and I've got another in the example directory in /usr/local/Cellar/solr/3.6.1/libexec/. When I did the rake

rake sunspot:solr:start 

command, schema.xml was copied into my app's solr directory. Is there more copying that needs happen? I'm not really sure how to fix this issue.

Upvotes: 1

Views: 1142

Answers (2)

Eduard
Eduard

Reputation: 3671

For Solr 4.7, copy schema.xml and solrconfig.xml from your_app/solr/conf to /opt/solr/solr/collection1 (or whatever your solr path is) and if still not working, make sure that your config/sunspot.yml is something like:

production:
  solr:
    hostname: localhost
    port: 8983
    log_level: WARNING
    path: /solr/collection1
    # read_timeout: 2
    # open_timeout: 0.5

It is recommended to create another core (my_core) from the solr web interface, copy schema.xml and solrconfig.xml to that folder and point path to /solr/my_core

Step by step guide here: http://blog.eemglobal.com/2014/07/setup-rails-4-with-sunspot-gem-and-solr-4-7-in-production-environment-on-ubuntu-14/

Upvotes: 1

Marko Bonaci
Marko Bonaci

Reputation: 5708

Put schema.xml in conf directory, under your Solr root.

Upvotes: 3

Related Questions