Sriram
Sriram

Reputation: 838

Building Solr indexes through Haystack throws unknown field error

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?

Upvotes: 8

Views: 3555

Answers (3)

jturnbull
jturnbull

Reputation: 720

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

Upvotes: 12

Herman Schaaf
Herman Schaaf

Reputation: 48485

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).

Upvotes: 1

Sriram
Sriram

Reputation: 838

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

Upvotes: 3

Related Questions