无法为solr/haystack构建索引:未知字段'django_id'

her*_*i0n 3 django solr django-haystack

我正在尝试跟随干草堆教程.运行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>
Run Code Online (Sandbox Code Playgroud)

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

我不得不手动创建conf目录,因为它不存在.我注意到教程使用Solr 3,而我在4上.是否可以改变conf dir的位置?

NEB*_*NEB 10

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

  • 将架构放在solr-xyz/example/solr/collection1/conf/schema.xml中

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

  • 将version字段(如下所述)添加到fields部分中的架构中

    <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
    
    Run Code Online (Sandbox Code Playgroud)

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


chi*_*rew 5

这更多是评论,但是由于我的观点不足,所以我无法发表评论...

有谁解决这个问题?我有完全相同的问题。字段的创建schema.xml方式如下:

<field name="django_id" type="string" indexed="true" stored="true" multiValued="false"/>
Run Code Online (Sandbox Code Playgroud)

我已多次重启Solr,并且100%肯定我的schema.xml代码正确。这里到底发生了什么?

编辑:我切换到Elasticsearch,没有问题。但是,我敢肯定其他人会对这个问题有所帮助。