【问题标题】:Problem adding to solr index using Django-Haystack使用 Django-Haystack 添加到 solr 索引的问题
【发布时间】:2011-03-19 21:47:09
【问题描述】:

我正在尝试使用 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)

【问题讨论】:

    标签: python django django-haystack


    【解决方案1】:

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

    【讨论】:

    • 我的架构是由build_solr_schema 生成的,所以它就在上面。我的架构位置是:~/apache-solr/example/conf/schema.xml 我正在通过java -jar ~/apache-solr/example/start.jar 运行它我指定这些路径是因为我是 Solr 的新手。
    • 我犯了一个愚蠢的错误,我查询的是 apache-solr 示例而不是 Tomcat 上安装的示例!
    【解决方案2】:

    尝试使用 text = CharField(document

    【讨论】:

      猜你喜欢
      • 2016-05-07
      • 2012-10-25
      • 1970-01-01
      • 1970-01-01
      • 2011-03-10
      • 2017-07-02
      • 1970-01-01
      • 2015-11-02
      • 2012-04-30
      相关资源
      最近更新 更多