2013-05-06 90 views
-2

我想指數模型Solr中與Django的草垛,但它返回我下面的錯誤(使用rebuild_index或update_index時): 它給我錯誤缺少架構錯誤

MissingSchema("Invalid URL %r: No schema supplied" % url) 
requests.exceptions.MissingSchema: Invalid URL u'127.0.0.1:8983/solr/update/?commit=true': No schema supplied 

這是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() 
+0

在solr配置中是否有schema.xml? – 2013-05-06 11:20:41

+0

是的,它在那裏 – 2013-05-06 11:25:27

+0

我的回答是否解決了您的問題? – Aldarund 2013-05-08 09:25:42

回答

1

您需要設置一個完整的URL包括http在草堆設置:

HAYSTACK_CONNECTIONS = { 
    'default': { 
    'ENGINE': 'haystack.backends.solr_backend.SolrEngine', 
    'URL': 'http://127.0.0.1:8983/solr' 
    }, 
}