8

I'm trying to integrate Haystack with Solr. When I try to build the index, I get an error "Unknown field django_id" from SOLR. What's causing this to happen?

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
Sriram
  • 838
  • 7
  • 15

3 Answers3

12

You also get this error if you haven't given Solr the schema.xml file which Haystack generates for you, as explained here in the docs.

django-haystack.readthedocs.io/en/latest/tutorial.html#reindex

karuhanga
  • 3,010
  • 1
  • 27
  • 30
jturnbull
  • 720
  • 7
  • 15
  • that's me! I forgot to copy the schema.xml :) – Tommaso Barbugli Jul 30 '11 at 19:20
  • 2
    After I placed my schema in the conf dir, I had to restart solr to get it to work. BTW, the conf dir is apache-solr-3.5.0/example/solr/conf. – Amjith Feb 06 '12 at 13:50
  • restarting solr was key for me, i tried different versions of haystack and a bunch of wierd ass configurations to no avail. one restart and everything started working. ::facepalm:: – Francis Yaconiello Jun 15 '12 at 14:51
  • the link above does not work anymore this one is up to date: http://django-haystack.readthedocs.io/en/latest/tutorial.html#reindex – matyas Oct 20 '16 at 15:34
3

The schema.xml was malformed as I had copied additional text from the console.

Sriram
  • 838
  • 7
  • 15
1

If you added new fields to your database and copied the generated XML files from Haystack, you might also be getting this error because you haven't restarted jetty/Tomcat/whatever server you are using. This solved it for me on Ubuntu and Jetty:

sudo /etc/init.d/jetty stop
sudo /etc/init.d/jetty start

(by the way, that would also be the same as simply doing this):

sudo service jetty restart

Or, if you are using tomcat, that would be

sudo service tomcat6 restart

Edit: (tested this with Tomcat, and it solved the same problem again, the same as with Jetty).

Herman Schaaf
  • 46,821
  • 21
  • 100
  • 139