Jos*_*wen 5 python django solr pysolr django-haystack
我目前在生产中使用 Solr 4.2.0(大约在 2012 年建立)。我已经建立了一个新的开发环境,我升级了所有包(Django 1.8.10、PySolr 3.4.0、Haystack 2.4.1)并设置了 Solr 5.5.0
我运行了 Solr,我的核心/集合是用 'basic_configs' 创建的,它似乎运行良好,除了在索引期间我遇到了很多类似于以下的错误:
All documents removed.
Indexing 9604 contracts
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [d
oc=accounting.contract.22] unknown field 'status']
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [d
oc=accounting.contract.70556] unknown field 'date_signed']
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [d
oc=accounting.contract.72059] unknown field 'date_signed']
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [d
oc=accounting.contract.73458] unknown field 'date_signed']
Run Code Online (Sandbox Code Playgroud)
查看 id,似乎大多数文档都很好,但足够频繁(列表还在继续)这些错误出现在所有表/索引中。
最终我遵循了这个有前途的 github 项目指南,但不幸的是它并没有为我解决问题。
我的 settings.py 有以下条目:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://localhost:8983/solr/spng',
'DEFAULT_OPERATOR': 'AND',
'INCLUDE_SPELLING': True,
},
}
Run Code Online (Sandbox Code Playgroud)
回应是:
{
"responseHeader":{
"status":0,
"QTime":300}}
Run Code Online (Sandbox Code Playgroud)
如前所述,我最终遇到了以下错误:
All documents removed.
Indexing 9604 contracts
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [d
oc=accounting.contract.22] unknown field 'status']
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [d
oc=accounting.contract.70556] unknown field 'date_signed']
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [d
oc=accounting.contract.72059] unknown field 'date_signed']
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [d
oc=accounting.contract.73458] unknown field 'date_signed']
Run Code Online (Sandbox Code Playgroud)
有谁知道可能有什么问题?索引在我的生产服务器上运行没有错误,运行 4.2.0。我错过了设置还是 Solr 5.5.0 导致了这些错误?
特别感谢elyograg在 Solr 的 IRC 频道(#solr on freenode)上为我提供帮助。
elyograg:如果您使用 basic_configs 中的库存 solrconfig.xml,那么您的架构位于名为“托管架构”的文件中——从 5.5 开始,所有示例配置默认都使用托管架构。
elyograg:将其(schema.xml 内容)放入托管架构中。您可能会更改 solrconfig.xml,但如果您保留默认值,那么对于试图帮助您的人来说,生活会更容易。
换句话说,从版本 5.5 开始,当使用 basic_configs 创建集合时,模式文件被称为“托管模式”,而不是 schema.xml(在我的例子中位于 /var/solr/data//conf/托管模式)
更新文件并重新加载核心后,索引完成且没有错误。
在未来的版本中要小心,因为elyograg还指出:
elyograg:添加 .xml 扩展名也可能是个好主意。我认为缺乏扩展不会对手工编辑产生太大的阻碍。
所以将来它可能会被称为 Managed-schema.xml
| 归档时间: |
|
| 查看次数: |
4757 次 |
| 最近记录: |