问题
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)
回答1:
The solution for me was actually simple. I had to remove the hash mark from the url and everything pulled as expected.
回答2:
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')
来源:https://stackoverflow.com/questions/43854546/pysolr-i-continually-get-json-decoder-error-when-attempting-a-query