-2

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) : it is giving me error

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

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()
madeeha ameer
  • 479
  • 2
  • 8
  • 22

1 Answers1

1

You need to set a full url including http in your haystack settings:

HAYSTACK_CONNECTIONS = {
  'default': {
    'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
    'URL': 'http://127.0.0.1:8983/solr'
  },
}
Aldarund
  • 17,312
  • 5
  • 73
  • 104