无法向 Solr 添加文档:[原因:未找到错误 404] [英] Failed to add documents to Solr: [Reason: Error 404 Not Found]
本文介绍了无法向 Solr 添加文档:[原因:未找到错误 404]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 django-haystack 在 Solr 中为模型建立索引,但它返回以下错误(使用重建索引或更新索引时):
I'm trying to index a model in Solr with django-haystack, but it returns me the following error(when using rebuild_index or update_index) :
Failed to add documents to Solr: [Reason: Error 404 Not Found]
这是search_indexes.py
This is 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 连接:
haystack connection:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr',
'SITECONF': 'jobpost.search_sites'
},
}
我多次生成schema.xml 重启solr..把它放在solr/conf..不知道isuue是什么
I have generated schema.xml many times restarted solr..placed it in solr/conf..don't know what's the isuue
推荐答案
按规定 在设置文档中,您需要指定核心的 url.似乎您错过了 URL 中的核心.您需要创建一个核心,网址应如下所示:
As specified in settings docs you need to specify the url to your core. Seems like you've missed the core in your URL. You need to create a core and the url should look like this:
'URL': 'http://localhost:9001/solr/default',
这篇关于无法向 Solr 添加文档:[原因:未找到错误 404]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文