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

问题描述

我正在尝试沿着干草堆教程。我运行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目录,因为它不存在。我注意到教程在我在4时使用Solr 3。conf dir的位置是否也可能更改?

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-xyz / 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

添加

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


有关更多信息,请查看相同的讨论

For more information check out the same discussion in GitHub

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

08-04 10:06