简体   繁体   English

Websorl 在构建 schema.xml 时返回错误“未知字段 'django_ct'”

[英]Websorl returns error “ unknown field 'django_ct' ” when building schema.xml

Our website runs with Python 3.6.5 and:我们的网站使用 Python 3.6.5 运行,并且:

  • django==1.11.20 django==1.11.20
  • django-haystack==2.8.1 django-haystack==2.8.1
  • certifi==0.0.8证书==0.0.8
  • urllib3<1.25,>=1.21.1 urllib3<1.25,>=1.21.1
  • pysolr==3.8.1 pysolr==3.8.1

I generated schema.xml with django-haystack (python manage.py build_solr_schema > schema.xml) and pasted it in websolr (heroku version).我使用 django-haystack(python manage.py build_solr_schema > schema.xml)生成了 schema.xml 并将其粘贴到 websolr(heroku 版本)中。

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']无法将文档添加到 Solr:Solr 响应错误(HTTP 400):[原因:错误:[doc=naturalearth.naturalearthmerged.12001] 未知字段 '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())回溯(最后一次调用):文件“/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())

File "/app/.heroku/python/lib/python3.6/site-packages/pysolr.py", line 918, in add overwrite=overwrite, handler=handler)文件“/app/.heroku/python/lib/python3.6/site-packages/pysolr.py”,第 918 行,添加覆盖=覆盖,处理程序=处理程序)

File "/app/.heroku/python/lib/python3.6/site-packages/pysolr.py", line 500, in _update _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'}) 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']文件“/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']

I guess it is related to the following lines in schema.xml:我猜它与 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?有什么线索吗?

I could not make it work with Solr.我无法使它与 Solr 一起工作。

If it can be useful to someone else, here is how I managed to have Django & Heroku work with django-haystack:如果它对其他人有用,这就是我设法让 Django 和 Heroku 与 django-haystack 一起工作的方法:

I switched to Heroku Bonsai and ElasticSearch.我切换到 Heroku 盆景和 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版本组合非常复杂,因为 Haystack 尚不支持 Elasticsearch 5.x、6.x 或 7.x,而多租户盆景计划仅支持版本 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因此,我安装了一个支持 ElasticSearch 5 的 django-haystack 分支: https://github.com/tehamalab/django-haystack-es

And created the addon in Heroku as below:并在 Heroku 中创建插件,如下所示:

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

Everything is fine now.现在一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM