djangoherokusolrdjango-haystackwebsolr

Websorl returns error " unknown field 'django_ct' " when building schema.xml


Our website runs with Python 3.6.5 and:

I generated schema.xml with django-haystack (python manage.py build_solr_schema > schema.xml) and pasted it in websolr (heroku version).

When I run below command:

heroku run python manage.py rebuild_index --app terradiem

I get the following error :

Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [doc=naturalearth.naturalearthmerged.12001] unknown field 'django_ct']

Traceback (most recent call last): File "/app/.heroku/python/lib/python3.6/site-packages/haystack/backends/solr_backend.py", line 72, in update self.conn.add(docs, commit=commit, boost=index.get_field_weights())

File "/app/.heroku/python/lib/python3.6/site-packages/pysolr.py", line 918, in add overwrite=overwrite, handler=handler)

File "/app/.heroku/python/lib/python3.6/site-packages/pysolr.py", line 500, in _update

return self._send_request('post', path, message, {'Content-type': 'text/xml; charset=utf-8'})

File "/app/.heroku/python/lib/python3.6/site-packages/pysolr.py", line 412, in _send_request raise SolrError(error_message % (resp.status_code, solr_message)) pysolr.SolrError: Solr responded with an error (HTTP 400): [Reason: ERROR: [doc=naturalearth.naturalearthmerged.12001] unknown field 'django_ct']

I guess it is related to the following lines in schema.xml :

<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="django_ct" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="django_id" type="string" indexed="true" stored="true" multiValued="false"/>

Any clue ?


Solution

  • I could not make it work with Solr.

    If it can be useful to someone else, here is how I managed to have Django & Heroku work with django-haystack:

    I switched to Heroku Bonsai and ElasticSearch.

    Combinations of versions were very complicated as Haystack does not yet support Elasticsearch 5.x, 6.x or 7.x, when Bonsai for multiple tenants plan only support versions 5.4.3 / 6.5.4 / 7.2.0

    I therefore installed a fork of django-haystack supporting ElasticSearch 5: https://github.com/tehamalab/django-haystack-es

    And created the addon in Heroku as below:

    heroku addons:create bonsai:staging -a terradiem --version=5.6.16
    

    Everything is fine now.