我試圖用django-haystack索引Solr中的模型,但它返回以下錯誤(使用rebuild_index或update_index時):無法將文檔添加到Solr:[原因:找不到404錯誤]
Failed to add documents to Solr: [Reason: Error 404 Not Found]
這是search_indexes.py
from haystack import indexes
from haystack.indexes import SearchIndex
from jobpost.models import *
class JobIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
post_type = indexes.CharField(model_attr='post_type')
location = indexes.CharField(model_attr='location')
job_type = indexes.CharField(model_attr='job_type')
company_name = indexes.CharField(model_attr='company_name')
title = indexes.CharField(model_attr='title')
def get_model(self):
return jobpost
def index_queryset(self,**kwargs):
return self.get_model().objects.all()
草垛連接:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr',
'SITECONF': 'jobpost.search_sites'
},
}
我有發電機密封ed schema.xml多次重新啓動solr ..將其放置在solr/conf中不知道是什麼isuue
它是否已啓動並且您可以通過訪問http://127.0.0.1:8983/solr瀏覽到solr服務器? – 2013-05-07 06:36:07
是的,它啓動了 – 2013-05-07 06:37:20
檢查solr日誌併發布錯誤信息,請 – 2013-05-07 06:43:44