0

EDIT: Comma or no after "A test document" and after the '}' yields the same result

Currently trying to use pysolr on my solr installation. FYI my solr admin page starts and loads at http://localhost:8983/solr/ just fine

The following is a snippet of the offending code (simplified from here, which as a whole gave the same errors). Note that this is just a snippet, I have the same imports and surrounding code that the above link has.

# Setup a Solr instance. The timeout is optional.
solr = pysolr.Solr('http://localhost:8983/solr/', timeout=10)

# How you'd index data.
solr.add([
    {
        "id": "doc_1",
        "title": "A test document",
    }
])

When running this, I get

$ python2 searcher.py 
Traceback (most recent call last):
  File "searcher.py", line 18, in <module>
    "title": "A test document",
  File "/usr/lib/python2.7/site-packages/pysolr.py", line 891, in add
    overwrite=overwrite, handler=handler)
  File "/usr/lib/python2.7/site-packages/pysolr.py", line 478, in _update
    return self._send_request('post', path, message, {'Content-type': 'text/xml; charset=utf-8'})
  File "/usr/lib/python2.7/site-packages/pysolr.py", line 393, in _send_request
    raise SolrError(error_message % (resp.status_code, solr_message))
pysolr.SolrError: Solr responded with an error (HTTP 404): [Reason: Error 404 Not Found]

Is there a way for me to diagnose logs or am I formatting something incorrectly?

user3210680
  • 98
  • 1
  • 1
  • 7

1 Answers1

4

You should specify core/collection name in the URL

ex:

solr = pysolr.Solr('http://localhost:8983/solr/collection1', timeout=10)
Vinod
  • 1,965
  • 1
  • 9
  • 18