无法将文档添加到Solr:[原因:找不到404错误]
我试图用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
如指定in settings docs您需要指定您的核心URL。似乎你错过了你的URL中的核心。您需要创建一个核心,并且url应如下所示:
'URL': 'http://localhost:9001/solr/default',
我的旧代码不需要指定最后一个'solr/default',但在更新了一些东西之后,我需要使用您指定的完整url。不确定哪个特定的版本升级导致它。 – TheGrimmScientist 2016-01-08 22:45:59
我甚至指定了核心,然后它也没有工作 – 2018-02-10 08:52:46
它是否已启动并且您可以通过访问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