3

我正在尝试使用 django-haystack 为 Solr 中的模型建立索引,但它返回了以下错误(使用rebuild_index 或 update_index 时):

Failed to add documents to Solr: [Reason: ERROR:unknown field 'django_ct']

我一步一步跟着 Haystack-Search 的“入门”。

我正在使用 :

  • 最新版本的 Apache Solr (1.4.1)
  • 最新版本的 django-haystack

我的 search_indexes.py :

from haystack.indexes import *
from haystack import site
from models import Entity

class EntityIndex(SearchIndex):
    name = CharField(document=True)

    def get_queryset(self):
        return Entity.objects.all()


site.register(Entity, EntityIndex)
4

2 回答 2

1

确保您的 $SOLR_HOME/conf/schema.xml 文件包含“django_ct”字段声明。这是一个自定义字段,需要与您正在使用的任何其他自定义字段一起手动添加。

于 2011-03-19T22:52:51.447 回答
0

尝试使用 text = CharField(document

于 2011-03-21T16:33:05.670 回答