Reputation: 1513
I'm making my blog on Django and I want to add site search based on django-haystack. I made a basic configuration of haystack, using official manuals, but when I want to test my search, I'm getting an error: 'Options' object has no attribute '_fields'
Here are some of my configs:
search_indexes.pyclass PostIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
title = indexes.CharField(model_attr='title')
pub_date = indexes.DateTimeField(model_attr='date')
def get_model(self):
return Post
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
return self.get_model().objects.all()
settings.py
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
So this is my problem. Does anyone worked with smth similar? Thanks in advance!
Upvotes: 2
Views: 653
Reputation: 6725
You are hitting a bug in the simple backend which is fixed in git. There doesn't seem to be a release which contains this fix, though, so you can either upgrade to the development version:
pip install -e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack
Or use a different backend (elasticsearch, solr, ...)
Upvotes: 6