Pysolr: I continually get json.decoder error when attempting a query

Deadly 提交于 2019-12-12 04:57:50

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!