无法为 solr/haystack 建立索引:未知字段“django_id" [英] Can't build index for solr/haystack: unknown field 'django_id'

查看:31
本文介绍了无法为 solr/haystack 建立索引:未知字段“django_id"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照 haystack 教程进行操作.运行 manage.py 重建索引时遇到错误

I'm trying to follow along the haystack tutorial. I run into an error when I run manage.py rebuild index

我收到以下错误:

WARNING: This will irreparably remove EVERYTHING from your search index.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y

Removing all documents from your index because you said so.
All documents removed.
/Users/heri0n/python_env/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808: RuntimeWarning: DateTimeField received a naive datetime (2013-04-07 16:14:15.481145) while time zone support is active.
  RuntimeWarning)
Indexing 1 notes.
Failed to add documents to Solr: [Reason: None]
<response><lst name="responseHeader"><int name="status">400</int><int name="QTime">6</int></lst><lst name="error"><str name="msg">ERROR: [doc=haystacktester.note.3] unknown field 'django_id'</str><int name="code">400</int></lst></response>

我确实运行了 manage.py build_solr_schema > ~/solr-4.2.1/example/solr/conf/schema.xml

I did run manage.py build_solr_schema > ~/solr-4.2.1/example/solr/conf/schema.xml

我不得不手动创建 conf 目录,因为它不存在.我注意到教程在我使用 Solr 3 时使用了 Solr 3.conf 目录的位置可能改变了吗?

I had to create the conf directory manually as it did not exist. I noticed the tutorial uses Solr 3 while I'm on 4. Did the location of the conf dir change perhaps?

推荐答案

问题是 Solr(haystack 文档使用 v3.5.0,这里你可能使用的是最新的)没有找到配置文件.这三个步骤对我有用

The problem is with the Solr (haystack document use v3.5.0, here you may be using the latest) not finding the configuration file. These 3 steps worked for me

  • 将架构放在 solr-x.y.z/example/solr/collection1/conf/schema.xml

  • Place the schema in solr-x.y.z/example/solr/collection1/conf/schema.xml

在架构中将 stopwords_en.txt 更改为 lang/stopwords_en.txt

In the schema change stopwords_en.txt to lang/stopwords_en.txt

将版本字段(如下所述)添加到字段部分的架构中

Add the version field (as mentioned below) to the schema in the fields section

<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>

有关更多信息,请查看 GitHub

For more information check out the same discussion in GitHub

这篇关于无法为 solr/haystack 建立索引:未知字段“django_id"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆