6

I've set up Solr 3.6.2 on Tomcat as described here.

Using the sunspot-rails gem and the embedded solr server I have no problems, but on my staging server I'm getting the response:

message ERROR: [doc=Foo 20] unknown field 'type'

description The request sent by the client was syntactically incorrect.

The request data looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<add>
  <doc>
    <field name="id">Foo 20</field>
    <field name="type">Foo</field>
    <field name="type">ActiveRecord::Base</field>
    <field name="class_name">Foo</field>
    <field name="name">test</field>
  </doc>
</add>

What's causing this? Is there some configuration that should be set? (I'm expecting something that allows for the type name to be used regardless of whether or not such a column exists.)

  • Hey There is already a solution for this problem -- http://stackoverflow.com/questions/13340859/cant-reindex-sunspot-solr-error-rsolrerrorhttp-500-internal-server-er – Snm Maurya Aug 04 '16 at 12:36

1 Answers1

8

It turns out that the sunspot-solr gem expects a slightly different schema.xml than the default that is bundled with solr.

I replaced the file with the one that the gem uses (from here) and it works fine now. This answer explains what the schema.xml file is.

Community
  • 1
  • 1
  • where did you replace it? I am copying my schema generated in development to production server, `solr_dir/example/solr`. From example folder I run `java -jar start.jar` – sites May 07 '13 at 05:41
  • Thank you! The schema.xml file that needs to be replaced lives in `//conf/schema.xml` – Matt Darby Nov 05 '13 at 20:16
  • And don't forget to **restart** Solr **after altering** `schema.xml` ! – Paul T. Rawkeen Apr 16 '15 at 09:13