Search code examples
djangosolrdjango-haystack

Solr issues with searching


I was using Apache Solr for quite some time and only recently started running into some severe issues with it. I'm using it with haystack and a django project. When I do it from manage.py shell i'm getting the below:

>>> from haystack.query import SearchQuerySet
>>> emps = SearchQuerySet().filter(django_ct='web.employer').filter(name__icontains='Mi')[:10]
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/haystack/query.py", line 241, in __getitem__
    self._fill_cache(start, bound)
  File "/usr/local/lib/python2.7/dist-packages/haystack/query.py", line 140, in _fill_cache
    results = self.query.get_results(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/haystack/backends/__init__.py", line 469, in get_results
    self.run(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/haystack/backends/solr_backend.py", line 501, in run
    results = self.backend.search(final_query, **search_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/haystack/backends/__init__.py", line 47, in wrapper
    return func(obj, query_string, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/haystack/backends/solr_backend.py", line 202, in search
    raw_results = self.conn.search(query_string, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pysolr.py", line 578, in search
    response = self._select(params)
  File "/usr/local/lib/python2.7/dist-packages/pysolr.py", line 308, in _select
    return self._send_request('get', path)
  File "/usr/local/lib/python2.7/dist-packages/pysolr.py", line 293, in _send_request
    error_message = self._extract_error(resp)
  File "/usr/local/lib/python2.7/dist-packages/pysolr.py", line 372, in _extract_error
    reason, full_html = self._scrape_response(resp.headers, resp.content)
  File "/usr/local/lib/python2.7/dist-packages/pysolr.py", line 404, in _scrape_response
    p_nodes = body_node.cssselect('p')
AttributeError: 'NoneType' object has no attribute 'cssselect'

I tried reinstalling haystack, lxml, cssselect, pysolr and still i'm getting these errors. Is there anything else I can try for this? Thanks for any help!

I also tried reading few other SO questions including this:

XML error object has no attribute 'cssselect'


Solution

  • Seems like the issue is with pysolr. You might find some help here.