2
import pysolr

solr = pysolr.Solr('http://replaced_url.abc:8983/solr/#/tran_timings_shard1_replica2/query', timeout=10)
results = solr.search('SubmitterId:clientname')

When pulling flat files I can go to the solr web interface http://replaced_url.abc:8983/solr/#/tran_timings_shard1_replica2/query and do a simple query of SubmitterId:clientname

I've searched for a couple hours now and tried to go by examples, but no matter what I put as the solr.search query variable, I consistently get the error:

raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

GeorgeLPerkins
  • 1,126
  • 10
  • 24

2 Answers2

5

The solution for me was actually simple. I had to remove the hash mark from the url and everything pulled as expected.

GeorgeLPerkins
  • 1,126
  • 10
  • 24
0

Looks like you have confused the constructor a bit with a specific endpoint address, rather than the service itself. Try doing this:

import pysolr

solr = pysolr.Solr('http://replaced_url.abc:8983/solr/tran_timings_shard1_replica2', search_handler='query', timeout=10)
results = solr.search('SubmitterId:clientname')
Dean Fenster
  • 2,345
  • 1
  • 18
  • 27
  • The simple :8983/solr/ will not work due to the fact that I need to point to a specific farm. I just noticed that my solr web interface is :8983/solr/#/tran_timings_shard1_replica2, but when I view the url given on the admin panel, it's missing the #. :8983/solr/tran_timings_shard1_replica2. So now I can now run the code and get a results object back with no error. I guess I just need to parse the object now for readability and see if it actually contains the expected results. – GeorgeLPerkins May 08 '17 at 18:34