我们的网站使用 Python 3.6.5 运行,并且:
- django==1.11.20
- django-haystack==2.8.1
- 证书==0.0.8
- urllib3<1.25,>=1.21.1
- pysolr==3.8.1
我用 django-haystack(python manage.py build_solr_schema > schema.xml)生成了 schema.xml,并将其粘贴到 websolr(heroku 版本)中。
当我运行以下命令时:
heroku run python manage.py rebuild_index --app terradiem
我收到以下错误:
无法将文档添加到 Solr:Solr 响应错误(HTTP 400):[原因:错误:[doc=naturalearth.naturalearthmerged.12001] 未知字段 'django_ct']
回溯(最后一次调用):文件“/app/.heroku/python/lib/python3.6/site-packages/haystack/backends/solr_backend.py”,第 72 行,更新 self.conn.add(docs, commit=commit, boost=index.get_field_weights())
文件“/app/.heroku/python/lib/python3.6/site-packages/pysolr.py”,第 918 行,添加覆盖=覆盖,处理程序=处理程序)
_update 中的文件“/app/.heroku/python/lib/python3.6/site-packages/pysolr.py”,第 500 行
return self._send_request('post', path, message, {'Content-type': 'text/xml; charset=utf-8'})
_send_request 中的文件“/app/.heroku/python/lib/python3.6/site-packages/pysolr.py”,第 412 行引发 SolrError(error_message % (resp.status_code, solr_message)) pysolr.SolrError: Solr 响应错误(HTTP 400):[原因:错误:[doc=naturalearth.naturalearthmerged.12001] 未知字段'django_ct']
我猜它与 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"/>
有什么线索吗?