【发布时间】:2019-09-25 08:57:43
【问题描述】:
我们的网站使用 Python 3.6.5 运行,并且:
- django==1.11.20
- django-haystack==2.8.1
- 证书==0.0.8
- urllib3=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']
Traceback(最近一次调用最后一次): 文件“/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 行,添加 覆盖=覆盖,处理程序=处理程序)
文件“/app/.heroku/python/lib/python3.6/site-packages/pysolr.py”,第500行,在_update中
return self._send_request('post', path, message, {'Content-type': 'text/xml; charset=utf-8'})
文件“/app/.heroku/python/lib/python3.6/site-packages/pysolr.py”,第 412 行,在 _send_request 引发 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"/>
有什么线索吗?
【问题讨论】:
-
我对 websolr 不熟悉,但是在更改
schema.xml文件后,您通常需要重新加载或重新启动内核。 -
您是否在设置中将“django.contrib.contenttypes”添加到您的 INSTALLED_APPS 中?
-
我重新加载了核心并包含了 'django.contrib.contenttypes。错误仍然存在。
标签: django heroku solr django-haystack websolr