Pysolr: I continually get json.decoder error when

2019-08-16 03:18发布

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)

标签: solr pysolr
2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-16 04:07

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

查看更多
老娘就宠你
3楼-- · 2019-08-16 04:10

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')
查看更多
登录 后发表回答