我正在尝试使用haystack在Django中实现solr 但面临错误
请帮助
search_indexes.py:
import datetime
from haystack import indexes
from search.models import Note
class NoteIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
author = indexes.CharField(model_attr='user')
pub_date = indexes.DateTimeField(model_attr='pub_date')
def get_model(self):
return Note
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
return self.get_model().objects.filter(pub_date__lte=datetime.datetime.now())
我做了以下指示:
python manage.py build_solr_schema
python manage.py rebuild_index
错误
raise SolrError(error_message % (resp.status_code, solr_message))
pysolr.SolrError: Solr responded with an error (HTTP 400): [Reason:
undefined field django_ct]