我是django haystack的新手,我正面临着开始使用它的麻烦。
当我搜索我得到错误
Failed to query Solr using '*:*': [Reason: Error 400 undefined field django_ct]
当我重建索引时出现此错误
WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'. Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y
Removing all documents from your index because you said so.
All documents removed.
ERROR:root:Error updating votingapp using default
Traceback (most recent call last):
...
...
index_qs = self.index_queryset(using=using)
TypeError: index_queryset() got an unexpected keyword argument 'using'
我已经设置了一个简单的索引类
class QuestionsIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
qs = indexes.CharField(model_attr='question')
def get_model(self):
return Questions
def index_queryset(self):
return self.get_model().objects.all()
在settings.py中添加了代码
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr'
# ...or for multicore...
# 'URL': 'http://127.0.0.1:8983/solr/mysite',
},
}
添加了网址
url(r'^search/', include('haystack.urls')),
查看代码
def home(request):
if request.method == "POST":
print SearchQuerySet().all()
return render_to_response('search.html',{})
请告知我在哪里做错了
答案 0 :(得分:0)
谢谢你的提问! 面对同样的错误后,我终于找到了问题所在。对我来说,这是干草堆无法处理的solr版本。 我安装了https://archive.apache.org/dist/lucene/solr/3.5.0/apache-solr-3.5.0.tgz 以下是一步一步: http://django-haystack.readthedocs.org/en/latest/installing_search_engines.html#solr 与你相同的conf。 希望这对你有用。 干杯, 最大