Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem adding to solr index using Django-Haystack

I'm trying to index a model in Solr with django-haystack, but it returns me the following error(when using rebuild_index or update_index) :

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

I followed step by step the "getting started" of Haystack-Search.

I'm using :

  • the latest version of Apache Solr (1.4.1)
  • the latest version of django-haystack

my 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)
like image 200
Anas Avatar asked Feb 21 '26 08:02

Anas


1 Answers

Be sure your $SOLR_HOME/conf/schema.xml file contains the 'django_ct' field declaration. That is a custom field and needs to be added manually along with any other custom fields you are using.

like image 172
Brent Worden Avatar answered Feb 22 '26 22:02

Brent Worden